MCPcopy Create free account
hub / github.com/encodeous/nylon / TestIPCStatus

Function TestIPCStatus

integration/ipc_test.go:64–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestIPCStatus(t *testing.T) {
65 defer goleak.VerifyNone(t)
66 vh, _ := setupTwoNodeHarness(t)
67 defer vh.Stop()
68
69 // Wait for links to come up
70 time.Sleep(3 * time.Second)
71
72 a := vh.Nylons[vh.IndexOf("a")].Load()
73 resp := ipcCall(t, a, &protocol.IpcRequest{
74 Request: &protocol.IpcRequest_Status{Status: &protocol.StatusRequest{}},
75 })
76
77 assert.True(t, resp.Ok)
78 s := resp.GetStatus()
79 require.NotNil(t, s.GetNode())
80 assert.Equal(t, "a", s.GetNode().NodeId)
81 assert.NotEmpty(t, s.GetNode().PublicKey)
82 assert.Equal(t, int32(1), s.GetNode().GetStats().NeighbourCount)
83 assert.GreaterOrEqual(t, s.GetNode().GetStats().SelectedRouteCount, int32(1))
84 assert.GreaterOrEqual(t, s.GetNode().GetStats().AdvertisedPrefixCount, int32(1))
85
86 require.Len(t, s.GetNeighbours(), 1)
87 peer := s.GetNeighbours()[0]
88 assert.Equal(t, "b", peer.PeerId)
89 assert.NotEmpty(t, peer.PublicKey)
90 require.NotEmpty(t, peer.GetEndpoints())
91 assert.GreaterOrEqual(t, len(peer.GetEndpoints()), 2)
92 assert.NotEmpty(t, peer.GetEndpoints()[0].Address)
93
94 assert.GreaterOrEqual(t, len(s.GetRoutes().GetSelected()), 1)
95 assert.GreaterOrEqual(t, len(s.GetRoutes().GetForward()), 1)
96 assert.GreaterOrEqual(t, len(s.GetFeasibilityDistances()), 1)
97}
98
99func TestIPCReloadConfig(t *testing.T) {
100 defer goleak.VerifyNone(t)

Callers

nothing calls this directly

Calls 14

setupTwoNodeHarnessFunction · 0.85
ipcCallFunction · 0.85
IndexOfMethod · 0.80
GetStatsMethod · 0.80
LenMethod · 0.80
GetNeighboursMethod · 0.80
GetSelectedMethod · 0.80
GetForwardMethod · 0.80
StopMethod · 0.65
GetStatusMethod · 0.45
GetNodeMethod · 0.45

Tested by

no test coverage detected