pool: replace defer cleanup with t.Cleanup

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun 2022-08-27 15:07:16 +08:00
parent f8ae8318c6
commit 5e6690107e
No known key found for this signature in database
GPG Key ID: DAEBBD2E34C111E6

View File

@ -71,7 +71,9 @@ func testWorkerPool(t *testing.T, test workerPoolTest) {
p := test.newPool()
startGeneric(t, p)
defer stopGeneric(t, p)
t.Cleanup(func() {
stopGeneric(t, p)
})
submitNonblockingGeneric(t, p, test.numWorkers)
})
@ -81,7 +83,9 @@ func testWorkerPool(t *testing.T, test workerPoolTest) {
p := test.newPool()
startGeneric(t, p)
defer stopGeneric(t, p)
t.Cleanup(func() {
stopGeneric(t, p)
})
submitBlockingGeneric(t, p, test.numWorkers)
})
@ -91,7 +95,9 @@ func testWorkerPool(t *testing.T, test workerPoolTest) {
p := test.newPool()
startGeneric(t, p)
defer stopGeneric(t, p)
t.Cleanup(func() {
stopGeneric(t, p)
})
submitPartialBlockingGeneric(t, p, test.numWorkers)
})