Skip to content

Commit 927ff1c

Browse files
committed
[FAB-2672] Fix TestDisclosurePolicyWithPull
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 <[email protected]>
1 parent db2021e commit 927ff1c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

gossip/discovery/discovery_test.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,17 @@ func TestDisclosurePolicyWithPull(t *testing.T) {
605605
// Sleep a while to let them establish membership. This time should be more than enough
606606
// because the instances are configured to pull membership in very high frequency from
607607
// up to 10 peers (which results in - pulling from everyone)
608-
time.Sleep(time.Second * 5)
608+
waitUntilOrFail(t, func() bool {
609+
for _, inst := range append(instances1, instances2...) {
610+
// Ensure the expected membership is equal in size to the actual membership
611+
// of each peer.
612+
portsOfKnownMembers := portsOfMembers(inst.GetMembership())
613+
if len(peersThatShouldBeKnownToPeers[inst.port]) != len(portsOfKnownMembers) {
614+
return false
615+
}
616+
}
617+
return true
618+
})
609619
for _, inst := range append(instances1, instances2...) {
610620
portsOfKnownMembers := portsOfMembers(inst.GetMembership())
611621
// Ensure the expected membership is equal to the actual membership

0 commit comments

Comments
 (0)