From 316666cc22c9659061966f6a257897ead6d7307a Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 17 Aug 2020 15:21:45 +0300 Subject: [PATCH] rpc/client: add tests for Ping --- pkg/rpc/server/client_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/rpc/server/client_test.go b/pkg/rpc/server/client_test.go index 08f4d0450..22374d282 100644 --- a/pkg/rpc/server/client_test.go +++ b/pkg/rpc/server/client_test.go @@ -156,3 +156,16 @@ func TestSignAndPushInvocationTx(t *testing.T) { require.Equal(t, h, tx.Hash()) require.EqualValues(t, 30, tx.SystemFee) } + +func TestPing(t *testing.T) { + chain, rpcSrv, httpSrv := initServerWithInMemoryChain(t) + defer chain.Close() + + c, err := client.New(context.Background(), httpSrv.URL, client.Options{Network: testchain.Network()}) + require.NoError(t, err) + + require.NoError(t, c.Ping()) + require.NoError(t, rpcSrv.Shutdown()) + httpSrv.Close() + require.Error(t, c.Ping()) +}