fix non-determinism in test
This commit is contained in:
parent
955344bf9b
commit
7912408642
|
@ -38,15 +38,19 @@ func TestPeerGater(t *testing.T) {
|
||||||
t.Fatal("expected AcceptAll")
|
t.Fatal("expected AcceptAll")
|
||||||
}
|
}
|
||||||
|
|
||||||
pg.RejectMessage(msg, rejectValidationIgnored)
|
for i := 0; i < 100; i++ {
|
||||||
status = pg.AcceptFrom(peerA)
|
pg.RejectMessage(msg, rejectValidationIgnored)
|
||||||
if status != AcceptControl {
|
pg.RejectMessage(msg, rejectValidationFailed)
|
||||||
t.Fatal("expected AcceptControl")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pg.RejectMessage(msg, rejectValidationFailed)
|
accepted := false
|
||||||
status = pg.AcceptFrom(peerA)
|
for i := 0; !accepted && i < 1000; i++ {
|
||||||
if status != AcceptControl {
|
status = pg.AcceptFrom(peerA)
|
||||||
|
if status == AcceptControl {
|
||||||
|
accepted = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !accepted {
|
||||||
t.Fatal("expected AcceptControl")
|
t.Fatal("expected AcceptControl")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +58,7 @@ func TestPeerGater(t *testing.T) {
|
||||||
pg.DeliverMessage(msg)
|
pg.DeliverMessage(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
accepted := false
|
accepted = false
|
||||||
for i := 0; !accepted && i < 1000; i++ {
|
for i := 0; !accepted && i < 1000; i++ {
|
||||||
status = pg.AcceptFrom(peerA)
|
status = pg.AcceptFrom(peerA)
|
||||||
if status == AcceptAll {
|
if status == AcceptAll {
|
||||||
|
|
Loading…
Reference in New Issue