From 5e6690107e765152bdaf4afaeb914dac256d0caa Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sat, 27 Aug 2022 15:07:16 +0800 Subject: [PATCH] pool: replace defer cleanup with `t.Cleanup` Signed-off-by: Eng Zer Jun --- pool/worker_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pool/worker_test.go b/pool/worker_test.go index d581c84f9..300cb323c 100644 --- a/pool/worker_test.go +++ b/pool/worker_test.go @@ -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) })