Merge pull request #1338 from weaveworks/1336-check-len
In ipam ring unit test, check if we have any peers with entries to avoid crash
This commit is contained in:
commit
aafa0f6783
1 file changed
+3
@@ -709,6 +709,9 @@ func TestFuzzRingHard(t *testing.T) {
|
|||||||
ringsWithEntries = append(ringsWithEntries, ring)
|
ringsWithEntries = append(ringsWithEntries, ring)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(ringsWithEntries) == 0 { // no rings have entries.
|
||||||
|
return
|
||||||
|
}
|
||||||
ring1 := ringsWithEntries[rand.Intn(len(ringsWithEntries))]
|
ring1 := ringsWithEntries[rand.Intn(len(ringsWithEntries))]
|
||||||
ring2index, _, ring2 := randomPeer(-1)
|
ring2index, _, ring2 := randomPeer(-1)
|
||||||
common.Log.Debugf("%s: 'Gossiping' to %s", ring1.Peer, ring2.Peer)
|
common.Log.Debugf("%s: 'Gossiping' to %s", ring1.Peer, ring2.Peer)
|
||||||
|
|||||||
Reference in new issue
Block a user