aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/network/hive_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/network/hive_test.go')
-rw-r--r--swarm/network/hive_test.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/swarm/network/hive_test.go b/swarm/network/hive_test.go
index 7ea000c1a..059c3dc96 100644
--- a/swarm/network/hive_test.go
+++ b/swarm/network/hive_test.go
@@ -39,8 +39,8 @@ func TestRegisterAndConnect(t *testing.T) {
params := NewHiveParams()
s, pp := newHiveTester(t, params, 1, nil)
- id := s.IDs[0]
- raddr := NewAddrFromNodeID(id)
+ node := s.Nodes[0]
+ raddr := NewAddr(node)
pp.Register(raddr)
// start the hive and wait for the connection
@@ -51,7 +51,7 @@ func TestRegisterAndConnect(t *testing.T) {
defer pp.Stop()
// retrieve and broadcast
err = s.TestDisconnected(&p2ptest.Disconnect{
- Peer: s.IDs[0],
+ Peer: s.Nodes[0].ID(),
Error: nil,
})
@@ -75,8 +75,8 @@ func TestHiveStatePersistance(t *testing.T) {
s, pp := newHiveTester(t, params, 5, store)
peers := make(map[string]bool)
- for _, id := range s.IDs {
- raddr := NewAddrFromNodeID(id)
+ for _, node := range s.Nodes {
+ raddr := NewAddr(node)
pp.Register(raddr)
peers[raddr.String()] = true
}
@@ -102,7 +102,10 @@ func TestHiveStatePersistance(t *testing.T) {
i++
return true
})
- if len(peers) != 0 || i != 5 {
- t.Fatalf("invalid peers loaded")
+ if i != 5 {
+ t.Errorf("invalid number of entries: got %v, want %v", i, 5)
+ }
+ if len(peers) != 0 {
+ t.Fatalf("%d peers left over: %v", len(peers), peers)
}
}