gateway: TestReasoningLoopIsAskedAgain takes the two tries' let-go in either order
The gateway cancels the looping try and asks again at once, so the next try can end and report before the first try's handler sees its write fail. macOS CI got them in that order (ddd4f431's run: "let go: the looping try false, the next true"). The next try only ever reports false, and the looping one reports false only after 20s unreleased, so one true and one false in any order still proves the looping try was let go. Run: reproduced CI's message on the old test by sleeping 300ms before each let-go of true; the new test passes with that delay and without it (-run 'TestReasoningLoop|TestLoop' -count=5).
This commit is contained in:
@@ -533,8 +533,13 @@ func TestReasoningLoopIsAskedAgain(t *testing.T) {
|
||||
if n := v.asked.Load(); n != 2 {
|
||||
t.Fatalf("the vendor was asked %d times, want 2", n)
|
||||
}
|
||||
if first, second := <-v.letGo, <-v.letGo; !first || second {
|
||||
t.Fatalf("let go: the looping try %v, the next %v", first, second)
|
||||
// The looping try is let go (true) and the next ends whole
|
||||
// (false), in whichever order the two handlers get there: the
|
||||
// next can finish before the first sees its request cancelled.
|
||||
// Only the next try sends false at once; the looping one sends
|
||||
// false only after 20s unreleased.
|
||||
if a, b := <-v.letGo, <-v.letGo; a == b {
|
||||
t.Fatalf("let go: %v and %v, want the looping try let go and the next not", a, b)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user