X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/5b778ad04422dd456b7d673fb653f0353c47b0fe..195c3fbb075383ac47bba310eb701b02774e8d10:/daemon_start_helper_test.go diff --git a/daemon_start_helper_test.go b/daemon_start_helper_test.go index 0c25acc..c43ff9c 100644 --- a/daemon_start_helper_test.go +++ b/daemon_start_helper_test.go @@ -2,8 +2,6 @@ package main import ( "context" - "io" - "log" "path/filepath" "testing" "time" @@ -37,12 +35,12 @@ func daemonStartTestWithWhatsApp(t *testing.T, server *ModelFake, bot *TelegramB func daemonStartTestWithSchedules(t *testing.T, server *ModelFake, bot *TelegramBot, whatsapp *WhatsApp, schedules *Schedules, clock func() time.Time) (string, *Memory) { t.Helper() - dir := t.TempDir() + dir := socketTestDir(t) agent, err := openAgent(filepath.Join(dir, daemonAgentDirName)) require.NoError(t, err) agent.config.Workdir = t.TempDir() - memory, err := openMemory(t.Context(), agent.dir, clock, newFakeSummarizer()) + memory, err := openMemory(t.Context(), agent.dir, clock, newFakeSummarizer(), discardLog()) require.NoError(t, err) socket := filepath.Join(dir, socketFileName) @@ -52,9 +50,10 @@ func daemonStartTestWithSchedules(t *testing.T, server *ModelFake, bot *Telegram client := newModelClient(server.URL, ModelAPIKey(modelTestKey), agent.CacheKey(), filepath.Join(agent.dir, "usage.jsonl")) ctx, cancel := context.WithCancel(t.Context()) done := make(chan error) + subagents := newTestSubagents(t) go func() { done <- daemonServe(ctx, listener, bot, whatsapp, schedules, func(notify func(Event)) (*TurnLoop, error) { - return newTurnLoop(agent, memory, newTestSubagents(t), whatsapp, schedules, client, clock, log.New(io.Discard, "", 0), notify) + return newTurnLoop(agent, memory, subagents, whatsapp, schedules, client, clock, discardLog(), notify) }) }()