mirror of
https://github.com/restic/restic.git
synced 2024-12-23 16:26:11 +00:00
Merge pull request #4417 from MichaelEischer/fix-flaky-list-cancel-test
backend: Fix unreliable TestListCancel/Timeout test
This commit is contained in:
commit
62d3ef4a93
1 changed files with 5 additions and 0 deletions
|
@ -428,6 +428,11 @@ func (s *Suite[C]) TestListCancel(t *testing.T) {
|
||||||
|
|
||||||
// wait until the context is cancelled
|
// wait until the context is cancelled
|
||||||
<-ctxTimeout.Done()
|
<-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
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue