diff --git a/swarm/network/kademlia_test.go b/swarm/network/kademlia_test.go index f5d87fee85..d2e051f457 100644 --- a/swarm/network/kademlia_test.go +++ b/swarm/network/kademlia_test.go @@ -263,12 +263,20 @@ func TestOffEffectingAddressBookNormalNode(t *testing.T) { if k.addrs.Size() != 1 { t.Fatal("known peer addresses should contain 1 entry") } + // peer should be among live connections + if k.conns.Size() != 1 { + t.Fatal("live peers should contain 1 entry") + } // remove peer from kademlia k.Off(newTestKadPeer(k, "01000000", false)) - // peer should not be in the address book + // peer should be in the address book if k.addrs.Size() != 1 { t.Fatal("known peer addresses should contain 1 entry") } + // peer should not be among live connections + if k.conns.Size() != 0 { + t.Fatal("live peers should contain 0 entry") + } } // a light node should not be in the address book @@ -280,12 +288,20 @@ func TestOffEffectingAddressBookLightNode(t *testing.T) { if k.addrs.Size() != 0 { t.Fatal("known peer addresses should contain 0 entry") } + // peer should be among live connections + if k.conns.Size() != 1 { + t.Fatal("live peers should contain 1 entry") + } // remove peer from kademlia k.Off(newTestKadPeer(k, "01000000", true)) // peer should not be in the address book if k.addrs.Size() != 0 { t.Fatal("known peer addresses should contain 0 entry") } + // peer should not be among live connections + if k.conns.Size() != 0 { + t.Fatal("live peers should contain 0 entry") + } } func TestSuggestPeerRetries(t *testing.T) {