feat: upload audio, get a private Swedish transcript, discuss it (#33, ADR-033) #39
@@ -218,8 +218,14 @@ func TestWorkerProcess_ShutdownMidJobLeavesTheRowForTheStartupSweep(t *testing.T
|
|||||||
func TestWorkerProcess_AJobThatOutlivesItsTimeoutIsFailedNotStuck(t *testing.T) {
|
func TestWorkerProcess_AJobThatOutlivesItsTimeoutIsFailedNotStuck(t *testing.T) {
|
||||||
r := newWRig(t, 50*time.Millisecond)
|
r := newWRig(t, 50*time.Millisecond)
|
||||||
r.tr.block = make(chan struct{}) // never released
|
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()
|
_, f := r.st.snapshot()
|
||||||
assert.Equal(t, domain.UploadErrTranscriptionFailed, f["a"], "a hung endpoint must end in failed, not an eternal spinner (ADR-025)")
|
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()
|
cancel()
|
||||||
<-stopped
|
<-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.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)
|
assert.ErrorIs(t, r.w.Submit(r.spool(t, "c")), uploads.ErrStopped)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user