From c10d26cf02d0d7fe86e286b73936694cb2c57af3 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 11 Apr 2016 12:26:24 +0100 Subject: [PATCH] Fix up TestBootstrap after consensus changes --- ipam/allocator_test.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ipam/allocator_test.go b/ipam/allocator_test.go index 300a147e..ff7146c4 100644 --- a/ipam/allocator_test.go +++ b/ipam/allocator_test.go @@ -117,6 +117,7 @@ func TestBootstrap(t *testing.T) { CheckAllExpectedMessagesSent(alloc1, alloc2) + // Check that tryPendingOps doesn't cause anything to happen here alloc1.actionChan <- func() { alloc1.tryPendingOps() } AssertNothingSent(t, done) @@ -129,14 +130,24 @@ func TestBootstrap(t *testing.T) { ExpectBroadcastMessage(alloc1, nil) alloc1.OnGossipBroadcast(alloc2.ourName, alloc2.Encode()) - // both nodes will get consensus now so initialize the ring - ExpectBroadcastMessage(alloc2, nil) + CheckAllExpectedMessagesSent(alloc1, alloc2) + + // at this point, both nodes have seen each other, but don't have a valid proposal + // so there is another exchange of messages ExpectBroadcastMessage(alloc2, nil) alloc2.OnGossipBroadcast(alloc1.ourName, alloc1.Encode()) + // we have consensus now so alloc1 will initialize the ring + ExpectBroadcastMessage(alloc1, nil) + alloc1.OnGossipBroadcast(alloc2.ourName, alloc2.Encode()) + + CheckAllExpectedMessagesSent(alloc1, alloc2) + + // alloc2 receives the ring and does not reply + alloc2.OnGossipBroadcast(alloc1.ourName, alloc1.Encode()) + CheckAllExpectedMessagesSent(alloc1, alloc2) - alloc1.OnGossipBroadcast(alloc2.ourName, alloc2.Encode()) // now alloc1 should have space AssertSent(t, done)