test.yml becomes callable; docker-publish.yml runs it as a gate job on
master and tag pushes and builds only when it succeeded. Pull requests
keep running test.yml directly, so nothing runs twice.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Fail the backup via a nonexistent source on the initialised default repo
instead of a nonexistent repository, so snapshot_count can actually go red.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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
compat.sh only grepped the check output for "Check Successful". check.sh
prints that string whenever restic exits 0, so a `restic check` that had
been turned into a no-op kept the suite green - the integrity check, half
the purpose of this image, was untested.
Adds a section that backs up, overwrites the first pack file under
/mnt/restic/data with garbage and then requires the failure path:
"Check Failed with Status", no "Check Successful", and
/var/log/check-error-last.log written. It uses its own throwaway container
so the later tests do not inherit the broken repository.
Verification on Git-Bash:
bash test/compat.sh -> 36 passed, 0 failed
sabotage (check.sh: restic check -> true), rebuilt image
IMAGE=rbd-sab-check bash test/compat.sh -> 33 passed, 3 failed, exit 1
- restic check detects a corrupted repository
- a corrupted repository is not reported as successful
- failing check writes check-error-last.log
check.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
MSYS rewrites POSIX-looking arguments before docker sees them, so
`docker exec <id> /usr/bin/backup` arrived as
`C:/Program Files/Git/usr/bin/backup` and the structure suite could not
read `--config /test/structure.yml`. 23 of 32 compat assertions and the
whole structure suite failed on Git-Bash, while test/lib.sh claimed the
suites behave identically on every platform.
test/lib.sh and test/run.sh now export MSYS_NO_PATHCONV=1 and
MSYS2_ARG_CONV_EXCL='*' themselves - lib.sh for the suites that source it,
run.sh for its own docker calls and the suites it starts as separate
processes. Both variables are ignored on Linux and macOS. README documents
that nothing has to be exported by hand.
Verified on Git-Bash without any variable set in the environment:
structure 13/13, compat 32/32, features 4 SKIP, exit 0, and
`bash test/run.sh --sabotage` still reports "sabotage check ok".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Agent-Id: agent-4966d0e6-7f4d-4b37-be3d-0648ed56cb8a
The pinned release URL returned 404. test/run.sh already falls back to the
official tool image when the binary is absent, so CI and local runs now take
the same path.
Also pin *.txt to LF and make the required-features lookup tolerate CRLF, so
the feature gate works on a Windows checkout too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Agent-Id: agent-7034f75b-1ddc-4aa1-a4ea-3a54b340e8d9
The repository had no tests: CI only built the image, and the old
container-structure-test setup was parked as config-broken.yml /
docker-compose.test.broken.yml. This adds suites that actually run the image.
- test/compat.sh: backup, restore, forget, check, hooks, failure handling and
timezone behaviour against the default configuration. These describe what
users depend on today, so a change that turns them red is a breaking change.
- test/features.sh: optional features, each guarded by a detection check
against the built image. Absent features are reported as SKIP, so open pull
requests do not turn master red, and their feature tests start running by
themselves once the pull request is rebased. Covers #109 (RESTIC_STREAM),
#99 (docker cli, bash) and #84 (msmtp).
- test/required-features.txt: once a feature is merged its gate is listed here
and a missing feature becomes a failure instead of a skip.
- test/structure.yml: revived image layout checks, falls back to the official
container-structure-test image when the tool is not installed.
- test/run.sh --sabotage: breaks the backup call on a throwaway copy of the
tree and expects the suite to fail, so the tests cannot be watered down into
always passing. CI runs this as its own step.
- .github/workflows/test.yml: shellcheck plus all suites on every pull request.
Also adds .gitattributes pinning shell scripts, the Dockerfile and YAML to LF.
With a Windows checkout (core.autocrlf=true) the scripts were checked out with
CRLF, and the resulting image failed to start with
"exec /entry.sh: no such file or directory".
No runtime file is touched, the image itself is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Agent-Id: agent-7034f75b-1ddc-4aa1-a4ea-3a54b340e8d9