X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/23ddb63351e5669d8e9fe7e688751ada55cb3072..21a3b4fb25cc8eef7f38fa8cb699e1f3ded92846:/services/ws/session_v0_test.go diff --git a/services/ws/session_v0_test.go b/services/ws/session_v0_test.go index 4a2da8012d..1213be5d14 100644 --- a/services/ws/session_v0_test.go +++ b/services/ws/session_v0_test.go @@ -83,7 +83,15 @@ func (s *v0Suite) TestLastLogID(c *check.C) { }), check.IsNil) s.expectStatus(c, r, 200) + avoidRace := make(chan struct{}, cap(uuidChan)) go func() { + // When last_log_id is given, although v0session sends + // old events in order, and sends new events in order, + // it doesn't necessarily finish sending all old + // events before sending any new events. To avoid + // hitting this bug in the test, we wait for the old + // events to arrive before emitting any new events. + <-avoidRace s.emitEvents(uuidChan) close(uuidChan) }() @@ -97,6 +105,7 @@ func (s *v0Suite) TestLastLogID(c *check.C) { } c.Check(lg.EventType, check.Equals, etype) } + avoidRace <- struct{}{} } }() }