Complete step 3 of the migration plan and clean up the implemented roadmap
This commit is contained in:
@@ -610,6 +610,8 @@ func TestRunPassesPreparedRequestToInjectedLLMClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEngineRunPropagatesCallerCancellation(t *testing.T) {
|
||||
const synchronizationTimeout = 5 * time.Second
|
||||
|
||||
started := make(chan struct{})
|
||||
transport := roundTripFunc(func(req *http.Request) (*http.Response, error) {
|
||||
close(started)
|
||||
@@ -640,10 +642,24 @@ func TestEngineRunPropagatesCallerCancellation(t *testing.T) {
|
||||
result <- err
|
||||
}()
|
||||
|
||||
<-started
|
||||
watchdog := time.NewTimer(synchronizationTimeout)
|
||||
defer watchdog.Stop()
|
||||
select {
|
||||
case <-started:
|
||||
case err := <-result:
|
||||
t.Fatalf("Engine.Run returned before the transport started: %v", err)
|
||||
case <-watchdog.C:
|
||||
t.Fatal("timed out waiting for the transport to start")
|
||||
}
|
||||
|
||||
cancel()
|
||||
if err := <-result; !errors.Is(err, scriptorium.ErrLLMGenerate) {
|
||||
t.Fatalf("expected ErrLLMGenerate after caller cancellation, got %v", err)
|
||||
select {
|
||||
case err := <-result:
|
||||
if !errors.Is(err, scriptorium.ErrLLMGenerate) {
|
||||
t.Fatalf("expected ErrLLMGenerate after caller cancellation, got %v", err)
|
||||
}
|
||||
case <-watchdog.C:
|
||||
t.Fatal("timed out waiting for Engine.Run to return after cancellation")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user