import (
"context"
"encoding/json"
- "errors"
"log"
"net/http"
"path/filepath"
func TestFailedCallEndsTheTurnWithoutARetry(t *testing.T) {
server := newModelFake(t)
- server.reply = func(w http.ResponseWriter, call ModelFakeCall) {
+ server.reply = func(w http.ResponseWriter, _ ModelFakeCall) {
http.Error(w, "busy", http.StatusServiceUnavailable)
}
require.Equal(t, 1, server.Calls())
require.Contains(t, test.events.Last("error"), "HTTP 503")
require.Equal(t, 1, strings.Count(test.logs.String(), "\n"))
- require.Contains(t, test.logs.String(), "the turn stops before its end, and the agent waits for the next message: ")
+ require.Contains(t, test.logs.String(), "turn failed: ")
require.Contains(t, test.logs.String(), "HTTP 503")
require.NotContains(t, test.logs.String(), "hello")
}
t.Cleanup(func() {
cancel()
- require.True(t, errors.Is(<-done, context.Canceled))
+ require.ErrorIs(t, <-done, context.Canceled)
require.NoError(t, memory.Close())
})