Codebase list golang-github-vbauerster-mpb / 1c40cc4
fixup! simplify TestWithContext Vladimir Bauer 4 years ago
1 changed file(s) with 8 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
8282
8383 start := make(chan struct{})
8484 done := make(chan struct{})
85 fail := make(chan struct{})
8586 bar := p.AddBar(0) // never complete bar
8687 go func() {
8788 close(start)
9697 select {
9798 case <-done:
9899 p.Wait()
99 case <-time.After(100 * time.Millisecond):
100 t.Error("Progress didn't stop")
100 case <-time.After(150 * time.Millisecond):
101 close(fail)
101102 }
102103 }()
103104
104105 <-start
105106 cancel()
106 <-shutdown
107 select {
108 case <-shutdown:
109 case <-fail:
110 t.Error("Progress didn't shutdown")
111 }
107112 }
108113
109114 // MaxWidthDistributor shouldn't stuck in the middle while removing or aborting a bar