You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
855 B

7 years ago
  1. package core_grpc_test
  2. import (
  3. "context"
  4. "os"
  5. "testing"
  6. "github.com/stretchr/testify/require"
  7. "github.com/tendermint/tendermint/abci/example/kvstore"
  8. core_grpc "github.com/tendermint/tendermint/rpc/grpc"
  9. rpctest "github.com/tendermint/tendermint/rpc/test"
  10. )
  11. func TestMain(m *testing.M) {
  12. // start a tendermint node in the background to test against
  13. app := kvstore.NewKVStoreApplication()
  14. node := rpctest.StartTendermint(app)
  15. code := m.Run()
  16. // and shut down proper at the end
  17. rpctest.StopTendermint(node)
  18. os.Exit(code)
  19. }
  20. func TestBroadcastTx(t *testing.T) {
  21. require := require.New(t)
  22. res, err := rpctest.GetGRPCClient().BroadcastTx(context.Background(), &core_grpc.RequestBroadcastTx{Tx: []byte("this is a tx")})
  23. require.Nil(err, "%+v", err)
  24. require.EqualValues(0, res.CheckTx.Code)
  25. require.EqualValues(0, res.DeliverTx.Code)
  26. }