make selection2 test less touchy
This commit is contained in:
parent
2eff03fa1f
commit
9aa8791920
@ -771,16 +771,26 @@ func TestOptimalMessageSelection2(t *testing.T) {
|
|||||||
t.Fatalf("expected %d messages, but got %d", expectedMsgs, len(msgs))
|
t.Fatalf("expected %d messages, but got %d", expectedMsgs, len(msgs))
|
||||||
}
|
}
|
||||||
|
|
||||||
nextNonce := uint64(0)
|
var nFrom1, nFrom2 int
|
||||||
|
var nextNonce1, nextNonce2 uint64
|
||||||
for _, m := range msgs {
|
for _, m := range msgs {
|
||||||
if m.Message.From != a2 {
|
if m.Message.From == a1 {
|
||||||
t.Fatal("expected message from a2")
|
if m.Message.Nonce != nextNonce1 {
|
||||||
|
t.Fatalf("expected nonce %d but got %d", nextNonce1, m.Message.Nonce)
|
||||||
|
}
|
||||||
|
nextNonce1++
|
||||||
|
nFrom1++
|
||||||
|
} else {
|
||||||
|
if m.Message.Nonce != nextNonce2 {
|
||||||
|
t.Fatalf("expected nonce %d but got %d", nextNonce2, m.Message.Nonce)
|
||||||
|
}
|
||||||
|
nextNonce2++
|
||||||
|
nFrom2++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Message.Nonce != nextNonce {
|
if nFrom1 > nFrom2 {
|
||||||
t.Fatalf("expected nonce %d but got %d", nextNonce, m.Message.Nonce)
|
t.Fatalf("expected more messages from a2 than a1; nFrom1=%d nFrom2=%d", nFrom1, nFrom2)
|
||||||
}
|
|
||||||
nextNonce++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user