restic
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not restic’s official test suite, and the restic project is not affiliated with atago.
Summary #
1 suite · 7 scenarios
Contents #
- restic (self-hosted backup program) — 7 scenarios
- version prints a semantic version
- init creates an encrypted repository on disk
- backup, list as JSON, and restore round-trip user data
- diff names exactly the file added between two snapshots
- check reports a healthy repository as error-free
- forget –keep-last 1 –prune drops the older snapshot
- the wrong password cannot unlock the repository
restic (self-hosted backup program) #
A backup tool is only worth anything if the restore works, so this suite follows restic through the entire lifecycle rather than stopping at “the backup succeeded”.
A repository is initialized, real data is backed up, snapshots are listed as
JSON, and the data is restored — and the restored files are compared against
the originals. Beyond that: diff between snapshots reports what actually
changed, the integrity check passes on a healthy repository, and retention
policies remove the snapshots they say they will and keep the rest.
The wrong password must fail. For an encrypted backup that is not an error path but the core guarantee: without the password the data is not recoverable, and that is asserted here as deliberately as the successful restore.
Source: test/e2e/thirdparty/restic/restic.atago.yaml
Scenario: version prints a semantic version #
When #
restic version
Then #
- exit code is
0 - stdout matches
/restic [0-9]+\.[0-9]+\.[0-9]+/
Scenario: init creates an encrypted repository on disk #
When #
restic init
Then #
- exit code is
0 - stdout contains
created restic repository - dir
repoexists, containsconfig, containskeys, containssnapshots
Scenario: backup, list as JSON, and restore round-trip user data #
Given #
- Fixture file
data/hello.txtis created. - Fixture file
data/sub/notes.mdis created.
Inputs #
Fixture data/hello.txt:
hello from atago
Fixture data/sub/notes.md:
# notes kept safe
When #
restic init
restic backup data
restic snapshots --json
# capture ${snap} from stdout
restic restore ${snap} --target restored
Then #
- after
restic backup data:- exit code is
0 - stdout matches
/snapshot [0-9a-f]{8} saved/
- exit code is
- after
restic snapshots --json:- exit code is
0 - stdout at
$has length 1 - stdout at
$[0].summary.total_files_processedequals2
- exit code is
- after
restic restore ${snap} --target restored:- exit code is
0 - stdout contains
Restored - file
restored/data/hello.txtcontainshello from atago - file
restored/data/sub/notes.mdcontains# notes kept safe
- exit code is
Scenario: diff names exactly the file added between two snapshots #
Given #
- Fixture file
data/base.txtis created. - Fixture file
data/added-later.txtis created.
Inputs #
Fixture data/base.txt:
first generation
Fixture data/added-later.txt:
second generation
When #
restic init
restic backup data
restic backup data
restic snapshots --json
# capture ${first} from stdout
# capture ${second} from stdout
restic diff ${first} ${second}
Then #
- after
restic snapshots --json:- exit code is
0 - stdout at
$has length 2
- exit code is
- after
restic diff ${first} ${second}:- exit code is
0 - stdout contains
+ /data/added-later.txt - stdout does not contain
/data/base.txt
- exit code is
Scenario: check reports a healthy repository as error-free #
Given #
- Fixture file
data/precious.txtis created.
Inputs #
Fixture data/precious.txt:
verify me
When #
restic init
restic backup data
restic check
Then #
- after
restic check:- exit code is
0 - stdout contains
no errors were found
- exit code is
Scenario: forget –keep-last 1 –prune drops the older snapshot #
Given #
- Fixture file
data/gen.txtis created. - Fixture file
data/gen.txtis created.
Inputs #
Fixture data/gen.txt:
one
Fixture data/gen.txt:
two
When #
restic init
restic backup data
restic backup data
restic forget --keep-last 1 --prune
restic snapshots --json
Then #
- after
restic forget --keep-last 1 --prune:- exit code is
0 - stdout contains
remove 1 snapshots
- exit code is
- after
restic snapshots --json:- exit code is
0 - stdout at
$has length 1
- exit code is
Scenario: the wrong password cannot unlock the repository #
Given #
- Environment variables are set: RESTIC_PASSWORD.
When #
restic init
restic snapshots
Then #
- after
restic snapshots:- exit code is not
0 - stderr contains
wrong password or no key found
- exit code is not