diff options
author | Felix Lange <fjl@twurst.com> | 2015-02-09 18:02:32 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-02-09 18:02:32 +0800 |
commit | 9915d3c3be831fa2c95ac277459945d969bd7b06 (patch) | |
tree | 600bbf3c5bc3bf995176fdbecb31d354be60d9ee /p2p/discover/table_test.go | |
parent | 028775a0863946c1e9ad51fe7b22faa5c59b2605 (diff) | |
download | dexon-9915d3c3be831fa2c95ac277459945d969bd7b06.tar.gz dexon-9915d3c3be831fa2c95ac277459945d969bd7b06.tar.zst dexon-9915d3c3be831fa2c95ac277459945d969bd7b06.zip |
p2p/discover: deflake UDP tests
Diffstat (limited to 'p2p/discover/table_test.go')
-rw-r--r-- | p2p/discover/table_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
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{}) |