diff --git a/internal/uploads/worker_test.go b/internal/uploads/worker_test.go index 27e2c11..da5235f 100644 --- a/internal/uploads/worker_test.go +++ b/internal/uploads/worker_test.go @@ -218,8 +218,14 @@ func TestWorkerProcess_ShutdownMidJobLeavesTheRowForTheStartupSweep(t *testing.T func TestWorkerProcess_AJobThatOutlivesItsTimeoutIsFailedNotStuck(t *testing.T) { r := newWRig(t, 50*time.Millisecond) r.tr.block = make(chan struct{}) // never released + done := make(chan struct{}) - r.w.Process(context.Background(), r.spool(t, "a")) + go func() { r.w.Process(context.Background(), r.spool(t, "a")); close(done) }() + select { + case <-done: + case <-time.After(5 * time.Second): + t.Fatal("Process did not return: a hung endpoint was not bounded by the job timeout") + } _, f := r.st.snapshot() assert.Equal(t, domain.UploadErrTranscriptionFailed, f["a"], "a hung endpoint must end in failed, not an eternal spinner (ADR-025)") @@ -270,6 +276,7 @@ func TestWorkerRun_StoppingDeletesQueuedAudioAndRefusesNewJobs(t *testing.T) { cancel() <-stopped + assert.Len(t, r.conv.srcs, 1, "a job still queued at shutdown must never be started: only the running job was converted") assert.Empty(t, r.leftovers(t), "audio of queued jobs is deleted on stop: the rows are swept to interrupted at next start") assert.ErrorIs(t, r.w.Submit(r.spool(t, "c")), uploads.ErrStopped) }