Skip to content

Commit

Permalink
tested network info
Browse files Browse the repository at this point in the history
  • Loading branch information
chandiniv1 committed Nov 15, 2023
1 parent 5736029 commit 65cb2af
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions node/full_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit 65cb2af

Please sign in to comment.