MCPcopy
hub / github.com/canopy-network/canopy / TestAddRemoveHas

Function TestAddRemoveHas

p2p/book_test.go:46–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestAddRemoveHas(t *testing.T) {
47 n1, n2 := newTestP2PNode(t), newTestP2PNode(t)
48 require.Len(t, n1.book.GetAll(), 0)
49 n2PeerAddress := &lib.PeerAddress{PublicKey: n2.pub, PeerMeta: &lib.PeerMeta{ChainId: 1}, NetAddress: "localhost:90001"}
50 n1.book.Add(&BookPeer{Address: n2PeerAddress})
51 require.True(t, n1.book.Has(n2PeerAddress))
52 n1.book.Remove(n2PeerAddress)
53 require.False(t, n1.book.Has(n2PeerAddress))
54}
55
56func TestAddFailedDialAttempt(t *testing.T) {
57 startConsecutiveFailedDialAttempt := int32(3)

Callers

nothing calls this directly

Calls 6

newTestP2PNodeFunction · 0.85
GetAllMethod · 0.80
LenMethod · 0.45
AddMethod · 0.45
HasMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected