Browse Source

rpc: move grpc_test from test/ to grpc/

pull/588/head
Ethan Buchman 7 years ago
parent
commit
d8ca0580a8
3 changed files with 33 additions and 54 deletions
  1. +33
    -0
      rpc/grpc/grpc_test.go
  2. +0
    -18
      rpc/test/grpc_test.go
  3. +0
    -36
      rpc/test/main_test.go

+ 33
- 0
rpc/grpc/grpc_test.go View File

@ -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)
}

+ 0
- 18
rpc/test/grpc_test.go View File

@ -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)
}

+ 0
- 36
rpc/test/main_test.go View File

@ -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)
}

Loading…
Cancel
Save