From d8ca0580a8f92284dd8c8b7a221f23f54fdaad58 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 13 Jul 2017 13:40:19 -0400 Subject: [PATCH] rpc: move grpc_test from test/ to grpc/ --- rpc/grpc/grpc_test.go | 33 +++++++++++++++++++++++++++++++++ rpc/test/grpc_test.go | 18 ------------------ rpc/test/main_test.go | 36 ------------------------------------ 3 files changed, 33 insertions(+), 54 deletions(-) create mode 100644 rpc/grpc/grpc_test.go delete mode 100644 rpc/test/grpc_test.go delete mode 100644 rpc/test/main_test.go diff --git a/rpc/grpc/grpc_test.go b/rpc/grpc/grpc_test.go new file mode 100644 index 000000000..cc8c9951c --- /dev/null +++ b/rpc/grpc/grpc_test.go @@ -0,0 +1,33 @@ +package core_grpc_test + +import ( + "os" + "testing" + + "github.com/stretchr/testify/require" + "golang.org/x/net/context" + + "github.com/tendermint/abci/example/dummy" + "github.com/tendermint/tendermint/rpc/grpc" + "github.com/tendermint/tendermint/rpc/test" +) + +func TestMain(m *testing.M) { + // start a tendermint node (and merkleeyes) in the background to test against + app := dummy.NewDummyApplication() + node := rpctest.StartTendermint(app) + code := m.Run() + + // and shut down proper at the end + node.Stop() + node.Wait() + os.Exit(code) +} + +func TestBroadcastTx(t *testing.T) { + require := require.New(t) + res, err := rpctest.GetGRPCClient().BroadcastTx(context.Background(), &core_grpc.RequestBroadcastTx{[]byte("this is a tx")}) + require.Nil(err, "%+v", err) + require.EqualValues(0, res.CheckTx.Code) + require.EqualValues(0, res.DeliverTx.Code) +} diff --git a/rpc/test/grpc_test.go b/rpc/test/grpc_test.go deleted file mode 100644 index 5ca40a3b0..000000000 --- a/rpc/test/grpc_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package rpctest - -import ( - "testing" - - "golang.org/x/net/context" - - "github.com/stretchr/testify/require" - core_grpc "github.com/tendermint/tendermint/rpc/grpc" -) - -func TestBroadcastTx(t *testing.T) { - require := require.New(t) - res, err := GetGRPCClient().BroadcastTx(context.Background(), &core_grpc.RequestBroadcastTx{[]byte("this is a tx")}) - require.Nil(err, "%+v", err) - require.EqualValues(0, res.CheckTx.Code) - require.EqualValues(0, res.DeliverTx.Code) -} diff --git a/rpc/test/main_test.go b/rpc/test/main_test.go deleted file mode 100644 index f95176d9b..000000000 --- a/rpc/test/main_test.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -package tests contain integration tests and helper functions for testing -the RPC interface - -In particular, it allows us to spin up a tendermint node in process, with -a live RPC server, which we can use to verify our rpc calls. It provides -all data structures, enabling us to do more complex tests (like node_test.go) -that introspect the blocks themselves to validate signatures and the like. - -It currently only spins up one node, it would be interesting to expand it -to multiple nodes to see the real effects of validating partially signed -blocks. -*/ -package rpctest - -import ( - "os" - "testing" - - "github.com/tendermint/abci/example/dummy" - nm "github.com/tendermint/tendermint/node" -) - -var node *nm.Node - -func TestMain(m *testing.M) { - // start a tendermint node (and merkleeyes) in the background to test against - app := dummy.NewDummyApplication() - node = StartTendermint(app) - code := m.Run() - - // and shut down proper at the end - node.Stop() - node.Wait() - os.Exit(code) -}