From c0c5906d0733c8b8f6511bf5e084c67ab949aad1 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 16 Apr 2016 10:11:06 +0100 Subject: [PATCH 1/2] 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() From d3be3d8912a8f54662aedb712a63d5c7fcec1ab5 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 18 Apr 2016 10:53:55 +0100 Subject: [PATCH 2/2] Remove outdated comment --- ipam/allocator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipam/allocator_test.go b/ipam/allocator_test.go index 139de9e4..d5f3b932 100644 --- a/ipam/allocator_test.go +++ b/ipam/allocator_test.go @@ -310,7 +310,7 @@ func TestTransfer(t *testing.T) { allocs, router, subnet := makeNetworkOfAllocators(3, cidr) alloc1 := allocs[0] alloc2 := allocs[1] - alloc3 := allocs[2] // This will be 'master' and get the first range + alloc3 := allocs[2] _, err := alloc2.Allocate("foo", subnet, returnFalse) require.True(t, err == nil, "Failed to get address")