diff --git a/progress_test.go b/progress_test.go index 9588548..36517f3 100644 --- a/progress_test.go +++ b/progress_test.go @@ -197,12 +197,11 @@ }), ) - for bar.IsRunning() { - time.Sleep(randomDuration(100 * time.Millisecond)) - bar.Increment() - } - - go p.Wait() + go func() { + for bar.IsRunning() { + bar.Increment() + } + }() select { case <-shutdown: @@ -212,6 +211,7 @@ case <-time.After(timeout): t.Errorf("Progress didn't shutdown after %v", timeout) } + p.Wait() } func randomDuration(max time.Duration) time.Duration {