swarm-archive vm test: the forget control picks a snapshot to delete and reads the refusal
This commit is contained in:
parent
7053dcffc0
commit
2ef62a3cc8
1 changed files with 5 additions and 1 deletions
|
|
@ -306,9 +306,13 @@ pkgs.testers.runNixOSTest {
|
||||||
snap = m.succeed(restic("alpha", "alpha", "snapshots --json")).split('"id":"')[1].split('"')[0]
|
snap = m.succeed(restic("alpha", "alpha", "snapshots --json")).split('"id":"')[1].split('"')[0]
|
||||||
# An old snapshot for the prune to drop. The backup is also the presence control: a lock, which a backup creates and removes, is deletable.
|
# An old snapshot for the prune to drop. The backup is also the presence control: a lock, which a backup creates and removes, is deletable.
|
||||||
m.succeed(restic("alpha", "alpha", "backup --host alpha --time '2000-01-01 00:00:00' ${agentRoot}/alpha/state"))
|
m.succeed(restic("alpha", "alpha", "backup --host alpha --time '2000-01-01 00:00:00' ${agentRoot}/alpha/state"))
|
||||||
|
both = m.succeed(restic("alpha", "alpha", "snapshots --json"))
|
||||||
|
assert both.count('"id"') == 2 and snap in both, both
|
||||||
assert status(m, "alpha", "alpha", f"snapshots/{snap}", "DELETE") == "403"
|
assert status(m, "alpha", "alpha", f"snapshots/{snap}", "DELETE") == "403"
|
||||||
assert status(m, "alpha", "alpha", "config", "POST") == "403"
|
assert status(m, "alpha", "alpha", "config", "POST") == "403"
|
||||||
m.fail(restic("alpha", "alpha", "forget --keep-last 1 --prune"))
|
# Grouped by host, as the server's prune does: the two snapshots have different paths, and the default grouping keeps the newest of each, so nothing would be forgotten. restic exits 0 when only the removal of a snapshot is refused, so the refusal is read from its output.
|
||||||
|
_, out = m.execute(restic("alpha", "alpha", "forget --group-by host --keep-last 1 --prune") + " 2>&1")
|
||||||
|
assert "unable to remove snapshot" in out and "403" in out, out
|
||||||
assert m.succeed(restic("alpha", "alpha", "snapshots --json")).count('"id"') == 2
|
assert m.succeed(restic("alpha", "alpha", "snapshots --json")).count('"id"') == 2
|
||||||
|
|
||||||
with subtest(f"{tag}: the server-side prune applies the retention"):
|
with subtest(f"{tag}: the server-side prune applies the retention"):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue