X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/5b778ad04422dd456b7d673fb653f0353c47b0fe..d9fddc0f506eb4ead7049f5638674b2b8773fcaa:/turn_test.go diff --git a/turn_test.go b/turn_test.go index 3cb15b2..5d93e08 100644 --- a/turn_test.go +++ b/turn_test.go @@ -3,7 +3,6 @@ package main import ( "context" "encoding/json" - "errors" "log" "net/http" "path/filepath" @@ -209,7 +208,7 @@ func TestInterruptEndsTheTurn(t *testing.T) { 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) } @@ -222,7 +221,7 @@ func TestFailedCallEndsTheTurnWithoutARetry(t *testing.T) { 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") } @@ -387,7 +386,7 @@ func newTestTurnLoopWith(t *testing.T, server *ModelFake, summarizer Summarizer) agent.config.Workdir = t.TempDir() clock := newTestClock() - memory, err := openMemory(t.Context(), t.TempDir(), clock.Now, summarizer) + memory, err := openMemory(t.Context(), t.TempDir(), clock.Now, summarizer, discardLog()) require.NoError(t, err) test := &TurnTestLoop{ @@ -410,7 +409,7 @@ func newTestTurnLoopWith(t *testing.T, server *ModelFake, summarizer Summarizer) t.Cleanup(func() { cancel() - require.True(t, errors.Is(<-done, context.Canceled)) + require.ErrorIs(t, <-done, context.Canceled) require.NoError(t, memory.Close()) })