Waits briefly to ensure logs are flushed

This commit is contained in:
Alliballibaba
2025-09-18 22:09:18 +02:00
parent 2297616552
commit 7a2bb89c9b

View File

@@ -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