2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

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
})