Skip to content

Commit

Permalink
[FAB-2672] Fix TestDisclosurePolicyWithPull
Browse files Browse the repository at this point in the history
Sometimes the sleep in the test isn't enough so when a comparison
is being made, the peers do not have enough time to discover each other,
and the result is the actual membership is is a subset of the expected.

Change-Id: Ibbfffea42e29554401ba77a8a73c3fd8c6ffb794
Signed-off-by: Yacov Manevich <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Mar 6, 2017
1 parent db2021e commit 927ff1c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gossip/discovery/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,17 @@ func TestDisclosurePolicyWithPull(t *testing.T) {
// Sleep a while to let them establish membership. This time should be more than enough
// because the instances are configured to pull membership in very high frequency from
// up to 10 peers (which results in - pulling from everyone)
time.Sleep(time.Second * 5)
waitUntilOrFail(t, func() bool {
for _, inst := range append(instances1, instances2...) {
// Ensure the expected membership is equal in size to the actual membership
// of each peer.
portsOfKnownMembers := portsOfMembers(inst.GetMembership())
if len(peersThatShouldBeKnownToPeers[inst.port]) != len(portsOfKnownMembers) {
return false
}
}
return true
})
for _, inst := range append(instances1, instances2...) {
portsOfKnownMembers := portsOfMembers(inst.GetMembership())
// Ensure the expected membership is equal to the actual membership
Expand Down

0 comments on commit 927ff1c

Please sign in to comment.