From f9cd736b336ee721b208f1a801c01360f65e5af9 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 28 Aug 2016 21:04:35 +0200 Subject: [PATCH] Fix flaky test --- src/restic/worker/pool_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/restic/worker/pool_test.go b/src/restic/worker/pool_test.go index 78cda9cd7..8fbcf7aec 100644 --- a/src/restic/worker/pool_test.go +++ b/src/restic/worker/pool_test.go @@ -99,7 +99,7 @@ type Job struct { func TestPoolCancel(t *testing.T) { barrier := make(chan struct{}) - wait := func(job worker.Job, done <-chan struct{}) (interface{}, error) { + sendTime := func(job worker.Job, done <-chan struct{}) (interface{}, error) { j := job.Data.(Job) <-barrier @@ -112,7 +112,7 @@ func TestPoolCancel(t *testing.T) { } } - jobCh, resCh, p := newBufferedPool(20, concurrency, wait) + jobCh, resCh, p := newBufferedPool(20, concurrency, sendTime) suc := make(chan struct{}) for i := 0; i < 20; i++ { @@ -120,7 +120,9 @@ func TestPoolCancel(t *testing.T) { } close(barrier) - <-suc + for i := 0; i < 10; i++ { + <-suc + } p.Cancel() p.Wait()