Skip to content

Commit

Permalink
tests: extract submit-after-close in its own test
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Perrin <[email protected]>
  • Loading branch information
kaworu committed Feb 5, 2021
1 parent 3238f7e commit ad95853
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions workerpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,6 @@ func TestWorkerPool(t *testing.T) {
t.Errorf("close: got '%v', want no error", err)
}

if err := wp.Submit("", nil); err != ErrClosed {
t.Errorf("submit: got '%v', want '%v'", err, ErrClosed)
}

results, err := wp.Drain()
if err != ErrClosed {
t.Errorf("drain: got '%v', want '%v'", err, ErrClosed)
Expand Down Expand Up @@ -283,6 +279,14 @@ func TestConcurrentDrain(t *testing.T) {
wg.Wait()
}

func TestWorkerPoolSubmitAfterClose(t *testing.T) {
wp := New(runtime.NumCPU())
wp.Close()
if err := wp.Submit("dummy", nil); err != ErrClosed {
t.Fatalf("got %v; want %v", err, ErrClosed)
}
}

func TestWorkerPoolManyClose(t *testing.T) {
wp := New(runtime.NumCPU())

Expand Down

0 comments on commit ad95853

Please sign in to comment.