test: prove RESTIC_JOB_ARGS reaches restic backup

The suite recorded RESTIC_JOB_ARGS only indirectly through backup-last.log,
which proves nothing about restic ever seeing the arguments. Removing
${RESTIC_JOB_ARGS} from the restic backup call in backup.sh left compat at
32 passed, 0 failed - exactly the failure class this PR is supposed to
catch, and exactly blocker 1 of PR #109.

compat.sh gets a section that runs a backup with
RESTIC_JOB_ARGS=--exclude=/data/skipme.txt and requires the excluded file
to be absent from the restore while the other file is restored intact, so
the arguments must have a visible effect.

features.sh gets the matching assertion inside the existing `stream`
feature gate (RESTIC_JOB_ARGS=--host=jobargshost must show up in the
snapshot metadata of a stdin backup). It is reported as SKIP until PR #109
is rebased, which is the point of the gate.

Verification on Git-Bash:
  bash test/run.sh -> structure 13/13, compat 39 passed 0 failed,
                      features 4 SKIP, exit 0
  sabotage (backup.sh:40 ${RESTIC_JOB_ARGS} removed), rebuilt image
  IMAGE=rbd-sab-jobargs bash test/compat.sh
    -> FAIL RESTIC_JOB_ARGS is passed to restic backup
       "the excluded file was backed up anyway"
    -> 38 passed, 1 failed, exit 1
backup.sh was restored with git checkout and the sabotage image removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Agent-Id: agent-4966d0e6-7f4d-4b37-be3d-0648ed56cb8a
This commit is contained in:
Tobias KaupatandClaude Opus 5 committed 2026-10-17 23:36:56 +02:00
1 parent 0aced54891
commit c138bd24d3
2 files changed
+42

No files matched your search

+18
View File
@@ -40,6 +40,24 @@ if require_feature stream "PR #109"; then
fi
stop_container
# Blocker 1 of PR #109: the stream branch must honour RESTIC_JOB_ARGS, the
# same way the file backup does. --host is used because it is visible in
# the snapshot metadata of a stdin backup.
start_container stream-jobargs \
-e RESTIC_STREAM=1 \
-e "RESTIC_STREAM_CMD=echo hello-stream" \
-e RESTIC_STREAM_FILENAME=stream.txt \
-e "RESTIC_JOB_ARGS=--host=jobargshost"
if wait_for_start; then
in_container /bin/backup >/dev/null 2>&1
stream_snapshots="$(in_container restic snapshots --json 2>/dev/null)"
assert_contains "$stream_snapshots" '"jobargshost"' \
"RESTIC_JOB_ARGS is passed to the stream backup"
else
fail "stream RESTIC_JOB_ARGS container starts"
fi
stop_container
# A half-configured stream must not look like a successful backup.
start_container stream-misconfigured -e RESTIC_STREAM=1
if wait_for_start; then