From 9915d3c3be831fa2c95ac277459945d969bd7b06 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 9 Feb 2015 11:02:32 +0100 Subject: p2p/discover: deflake UDP tests --- p2p/discover/table_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'p2p/discover/table_test.go') diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 9b05ce7f4..08faea68e 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -14,6 +14,18 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) +func TestTable_bumpOrAddBucketAssign(t *testing.T) { + tab := newTable(nil, NodeID{}, &net.UDPAddr{}) + for i := 1; i < len(tab.buckets); i++ { + tab.bumpOrAdd(randomID(tab.self.ID, i), &net.UDPAddr{}) + } + for i, b := range tab.buckets { + if i > 0 && len(b.entries) != 1 { + t.Errorf("bucket %d has %d entries, want 1", i, len(b.entries)) + } + } +} + func TestTable_bumpOrAddPingReplace(t *testing.T) { pingC := make(pingC) tab := newTable(pingC, NodeID{}, &net.UDPAddr{}) -- cgit v1.2.3