diff --git a/threadtaskworker_test.go b/threadtaskworker_test.go index f10ad2b7..73507cd4 100644 --- a/threadtaskworker_test.go +++ b/threadtaskworker_test.go @@ -5,6 +5,7 @@ import ( "log/slog" "net/http/httptest" "testing" + "time" "github.com/stretchr/testify/assert" ) @@ -61,7 +62,8 @@ func TestDispatchToTaskWorkerFromWorker(t *testing.T) { assertGetRequest(t, "http://example.com/testdata/tasks/task-dispatcher.php?count=4", "dispatched 4 tasks") - // shutdown to ensure all logs are flushed + // wait and shutdown to ensure all logs are flushed + time.Sleep(10 * time.Millisecond) Shutdown() // task output appears in logs at info level