Test quak backup end to end against a fake Ente server (closes #186) #191

Merged
clawbot merged 1 commits from issue-186-backup-end-to-end-test into next 2026-10-14 03:38:39 +02:00
Collaborator

Adds test/cli/backup-end-to-end.test.ts, which runs quak backup the way cron does: backupCommand through run, the real loadSession reading a session file that saveSession wrote after logging in, the retry options of quak backup with the waits stubbed, and every request answered by a fake of the Ente HTTP API serving data encrypted with libsodium. Nothing of quak's own code is replaced.

It covers each case of #186: the backup tree for an account with two albums of its own and one shared with it (a JPEG with EXIF in both, a video, a live photo), a second run that downloads nothing, a download that succeeds after two 503s, a 404 recorded in failures.json with exit 1, a refresh answered 401 with exit 3 that writes nothing but its lock, and --verify putting back an original changed on disk. No case showed a defect, so nothing was left out.

buildMetaFetch, its state type and the two encryption helpers moved from test/cli/metadata-backup.test.ts into test/ente-server.ts as they were, so both tests use them. The account setup at the top of buildMetaMock moved there too, as buildAccount(password), with its lines unchanged; buildMetaMock now calls it.

  • Deviation: no failing-tests-first commit, since the issue adds tests for behaviour that already exists.
  • Judgement call: the README's API reference names the new test beside test/cli/backup.test.ts.

Model: opus-5-5

Adds `test/cli/backup-end-to-end.test.ts`, which runs `quak backup` the way cron does: `backupCommand` through `run`, the real `loadSession` reading a session file that `saveSession` wrote after logging in, the retry options of `quak backup` with the waits stubbed, and every request answered by a fake of the Ente HTTP API serving data encrypted with libsodium. Nothing of quak's own code is replaced. It covers each case of https://git.eeqj.de/sneak/quak/issues/186: the backup tree for an account with two albums of its own and one shared with it (a JPEG with EXIF in both, a video, a live photo), a second run that downloads nothing, a download that succeeds after two 503s, a 404 recorded in `failures.json` with exit 1, a refresh answered 401 with exit 3 that writes nothing but its lock, and `--verify` putting back an original changed on disk. No case showed a defect, so nothing was left out. `buildMetaFetch`, its state type and the two encryption helpers moved from `test/cli/metadata-backup.test.ts` into `test/ente-server.ts` as they were, so both tests use them. The account setup at the top of `buildMetaMock` moved there too, as `buildAccount(password)`, with its lines unchanged; `buildMetaMock` now calls it. - Deviation: no failing-tests-first commit, since the issue adds tests for behaviour that already exists. - Judgement call: the README's API reference names the new test beside `test/cli/backup.test.ts`. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 02:32:05 +02:00
clawbot self-assigned this 2026-10-14 02:32:05 +02:00
Author
Collaborator

Review passed.
Model: opus-5-5

Review passed. Model: opus-5-5
clawbot added 1 commit 2026-10-14 03:24:56 +02:00
test/cli/backup-end-to-end.test.ts runs backupCommand through run, as
bin/quak.ts does, with the real loadSession reading a session saved after
logging in, and every request answered by a fake of the Ente HTTP API serving
data encrypted with libsodium. It covers the backup tree of an account with
two albums of its own and one shared with it, a second run that downloads
nothing, a download that succeeds after two 503s, a 404 recorded in
failures.json with exit 1, a refresh answered 401 with exit 3, and --verify
putting back an original changed on disk.

The fake server and the account it logs in moved from the backup-metadata
test into test/ente-server.ts, unchanged, so both tests use them.

Model: opus-5-5
clawbot force-pushed issue-186-backup-end-to-end-test from 1f7171ef58 to 2322ba3dde 2026-10-14 03:24:56 +02:00 Compare
clawbot merged commit 54133cfa5f into next 2026-10-14 03:38:39 +02:00
clawbot deleted branch issue-186-backup-end-to-end-test 2026-10-14 03:38:39 +02:00
clawbot removed the needs-review label 2026-10-14 03:38:39 +02:00
Sign in to join this conversation.