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
832 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. "github.com/tendermint/tendermint/rpc/grpc"
  9. "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. node.Stop()
  18. node.Wait()
  19. os.Exit(code)
  20. }
  21. func TestBroadcastTx(t *testing.T) {
  22. require := require.New(t)
  23. res, err := rpctest.GetGRPCClient().BroadcastTx(context.Background(), &core_grpc.RequestBroadcastTx{Tx: []byte("this is a tx")})
  24. require.Nil(err, "%+v", err)
  25. require.EqualValues(0, res.CheckTx.Code)
  26. require.EqualValues(0, res.DeliverTx.Code)
  27. }