From 65cb2af64c659f278d8d8db452eac448b1fd8c77 Mon Sep 17 00:00:00 2001 From: chandiniv1 Date: Thu, 19 Oct 2023 12:51:33 +0530 Subject: [PATCH] tested network info --- node/full_client_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/node/full_client_test.go b/node/full_client_test.go index 52e6e7bef..e7a52c307 100644 --- a/node/full_client_test.go +++ b/node/full_client_test.go @@ -1172,3 +1172,29 @@ func TestHealth(t *testing.T) { assert.Nil(err) assert.Empty(resultHealth) } + +func TestNetInfo(t *testing.T) { + assert := assert.New(t) + require := require.New(t) + + mockApp, rpc := getRPC(t) + mockApp.On("BeginBlock", mock.Anything).Return(abci.ResponseBeginBlock{}) + mockApp.On("CheckTx", mock.Anything).Return(abci.ResponseCheckTx{}) + mockApp.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}) + mockApp.On("Commit", mock.Anything).Return(abci.ResponseCommit{}) + + err := rpc.node.Start() + require.NoError(err) + defer func() { + err := rpc.node.Stop() + require.NoError(err) + }() + + netInfo, err := rpc.NetInfo(context.Background()) + require.NoError(err) + assert.NotNil(netInfo) + + assert.True(netInfo.Listening) + assert.Equal("/ip4/127.0.0.1/tcp/7676", netInfo.Listeners[0]) + assert.Equal(0, len(netInfo.Peers)) +}