diff --git a/nix/vm-tests/swarm-archive.nix b/nix/vm-tests/swarm-archive.nix index aacc367f0..7d142a428 100644 --- a/nix/vm-tests/swarm-archive.nix +++ b/nix/vm-tests/swarm-archive.nix @@ -306,9 +306,13 @@ pkgs.testers.runNixOSTest { 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. 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", "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 with subtest(f"{tag}: the server-side prune applies the retention"):