test(transcribe): the wrapper does not restart a cancelled job; PlanFor of an empty or unknown language is pinned (#61)
Low findings of the PR #62 re-review: the WithTimeout test's comment claimed cancellation travels on the context but only the language was asserted (the WithoutCancel mutant survived), and PlanFor('') and PlanFor(unknown) were untested. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -131,3 +131,16 @@ func TestWithTimeout_TheEngineStillReceivesTheLanguageOfTheJob(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithTimeout_ACancelledJobIsNotRestartedByTheWrapper(t *testing.T) {
|
||||
var got seen
|
||||
srv := serve(t, 200, verboseJSON, &got)
|
||||
b := transcribe.WithTimeout(transcribe.NewGateway(srv.URL+"/v1", "k", "iguana/kb-whisper", srv.Client()), time.Minute)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
_, err := b.Transcribe(ctx, wavFile(t, "RIFF-synthetic-pcm"))
|
||||
|
||||
require.Error(t, err)
|
||||
assert.Empty(t, got.method, "a cancelled job must not send its audio anywhere through the wrapper")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user