Compare commits

...

2 Commits

Author SHA1 Message Date
William Banfield
e193156add remove sleep that guarded against nondeterministic behavior 2021-11-09 15:34:39 -05:00
William Banfield
1cf795f9f7 evidence: remove source of non-determinism from test 2021-11-09 15:27:30 -05:00

View File

@@ -394,11 +394,8 @@ func TestReactorBroadcastEvidence_Pending(t *testing.T) {
require.Len(t, rts.pools, 2)
assert.EqualValues(t, numEvidence, rts.pools[primary.NodeID].Size(),
"primary node should have all the evidence")
if assert.EqualValues(t, numEvidence, rts.pools[secondary.NodeID].Size(),
"secondary nodes should have caught up") {
rts.assertEvidenceChannelsEmpty(t)
}
assert.EqualValues(t, numEvidence, rts.pools[secondary.NodeID].Size(),
"secondary nodes should have caught up")
}
func TestReactorBroadcastEvidence_Committed(t *testing.T) {
@@ -438,11 +435,6 @@ func TestReactorBroadcastEvidence_Committed(t *testing.T) {
// start the network and ensure it's configured
rts.start(t)
// without the following sleep the test consistently fails;
// likely because the sleep forces a context switch that lets
// the router process other operations.
time.Sleep(2 * time.Millisecond)
// The secondary reactor should have received all the evidence ignoring the
// already committed evidence.
rts.waitForEvidence(t, evList[numEvidence/2:], secondary.NodeID)
@@ -450,11 +442,8 @@ func TestReactorBroadcastEvidence_Committed(t *testing.T) {
require.Len(t, rts.pools, 2)
assert.EqualValues(t, numEvidence, rts.pools[primary.NodeID].Size(),
"primary node should have all the evidence")
if assert.EqualValues(t, numEvidence/2, rts.pools[secondary.NodeID].Size(),
"secondary nodes should have caught up") {
rts.assertEvidenceChannelsEmpty(t)
}
assert.EqualValues(t, numEvidence/2, rts.pools[secondary.NodeID].Size(),
"secondary nodes should have caught up")
}
func TestReactorBroadcastEvidence_FullyConnected(t *testing.T) {