rpc: fix tests

This commit is contained in:
Ethan Buchman 2017-11-27 22:35:16 +00:00
parent 9529f12c28
commit 2e76b23c9a
2 changed files with 9 additions and 25 deletions

View File

@ -96,10 +96,8 @@ func TestABCIRecorder(t *testing.T) {
_, err := r.ABCIInfo()
assert.Nil(err, "expected no err on info")
_, err = r.ABCIInfo()
assert.Nil(err, "expected no err on info")
_, err := r.ABCIQueryWithOptions("path", data.Bytes("data"), client.ABCIQueryOptions{Trusted: false})
_, err = r.ABCIQueryWithOptions("path", data.Bytes("data"), client.ABCIQueryOptions{Trusted: false})
assert.NotNil(err, "expected error on query")
require.Equal(2, len(r.Calls))

View File

@ -318,8 +318,7 @@ func TestWSNewWSRPCFunc(t *testing.T) {
err = cl.Call(context.Background(), "echo_ws", params)
require.Nil(t, err)
select {
case msg := <-cl.ResponsesCh:
msg := <-cl.ResponsesCh
if msg.Error != nil {
t.Fatal(err)
}
@ -329,12 +328,6 @@ func TestWSNewWSRPCFunc(t *testing.T) {
got := result.Value
assert.Equal(t, got, val)
}
result := new(ResultEcho)
err = json.Unmarshal(*msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
}
func TestWSHandlesArrayParams(t *testing.T) {
cl := client.NewWSClient(tcpAddr, websocketEndpoint)
@ -348,8 +341,7 @@ func TestWSHandlesArrayParams(t *testing.T) {
err = cl.CallWithArrayParams(context.Background(), "echo_ws", params)
require.Nil(t, err)
select {
case msg := <-cl.ResponsesCh:
msg := <-cl.ResponsesCh
if msg.Error != nil {
t.Fatalf("%+v", err)
}
@ -359,12 +351,6 @@ func TestWSHandlesArrayParams(t *testing.T) {
got := result.Value
assert.Equal(t, got, val)
}
result := new(ResultEcho)
err = json.Unmarshal(*msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
}
// TestWSClientPingPong checks that a client & server exchange pings
// & pongs so connection stays alive.