Merge pull request #4417 from MichaelEischer/fix-flaky-list-cancel-test

backend: Fix unreliable TestListCancel/Timeout test
This commit is contained in:
Michael Eischer 2023-07-23 18:04:11 +02:00 committed by GitHub
commit 62d3ef4a93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -428,6 +428,11 @@ func (s *Suite[C]) TestListCancel(t *testing.T) {
// wait until the context is cancelled
<-ctxTimeout.Done()
// The cancellation of a context first closes the done channel of the context and
// _afterwards_ propagates the cancellation to child contexts. If the List
// implementation uses a child context, then it may take a moment until that context
// is also cancelled. Thus give the context cancellation a moment to propagate.
time.Sleep(time.Millisecond)
return nil
})