From c0c5906d0733c8b8f6511bf5e084c67ab949aad1 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 16 Apr 2016 10:11:06 +0100 Subject: [PATCH] fix simulation of periodic gossip in TestTransfer `GossipBroadcast` in the `TestRouter` only goes one hop. In `TestTransfer` the three peers are connected in a chain, and hence we need to take extra care to ensure propagation to all peers. Fixes #2180. --- ipam/allocator_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipam/allocator_test.go b/ipam/allocator_test.go index 766e5041..139de9e4 100644 --- a/ipam/allocator_test.go +++ b/ipam/allocator_test.go @@ -318,10 +318,12 @@ func TestTransfer(t *testing.T) { _, err = alloc3.Allocate("bar", subnet, returnFalse) require.True(t, err == nil, "Failed to get address") + // simulation of periodic gossip alloc2.gossip.GossipBroadcast(alloc2.Gossip()) router.Flush() - alloc2.gossip.GossipBroadcast(alloc3.Gossip()) + alloc1.gossip.GossipBroadcast(alloc1.Gossip()) router.Flush() + router.RemovePeer(alloc2.ourName) router.RemovePeer(alloc3.ourName) alloc2.Stop()