X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/2a276c273c21a1752d541bf87e074c5d1c27e30f..c781f79f3c8cb9a7577ee1574d196988da2719b3:/backup_test.go?ds=sidebyside diff --git a/backup_test.go b/backup_test.go index 6271f8a..2fb218a 100644 --- a/backup_test.go +++ b/backup_test.go @@ -26,6 +26,7 @@ func TestRunningDaemonBackupRestoresTheChatAndLinks(t *testing.T) { "agent/instructions.md": "Keep the instructions.\n", "agent/telegram-offset.json": "23\n", } + for name, data := range files { path := filepath.Join(dir, name) require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o700)) @@ -236,6 +237,7 @@ func TestUnsafeRestoreInstallsNoArchiveFiles(t *testing.T) { Mode: 0o600, }, ) + dir := t.TempDir() err := backupRestore(t.Context(), archive, dir) require.ErrorContains(t, err, "unsafe archive path") @@ -337,6 +339,7 @@ func TestSessionBackupWaitsForRemovalToFinish(t *testing.T) { require.Never(t, func() bool { return len(backedUp) != 0 }, 50*time.Millisecond, time.Millisecond) + release.Do(func() { close(disconnect.release) }) @@ -378,7 +381,7 @@ func backupStartDaemon(t *testing.T, dir string) (*Memory, *WhatsApp, *Subagents whatsapp, _, _ := whatsappStartTest(t, dir, clock) subagents := newSubagents(filepath.Join(agent.dir, subagentDirName), clock.Now, subagentNameRandom) - schedules, err := openSchedules(filepath.Join(agent.dir, scheduleFileName), clock.Now, discardLog()) + schedules, err := openSchedules(filepath.Join(agent.dir, scheduleFileName), "OneChat", clock.Now, discardLog()) require.NoError(t, err) server := newModelFake(t)