aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-13 20:28:01 +0000
committertv <tv@krebsco.de>2026-11-13 21:59:25 +0100
commit75284cd34fb7183fffa77886c63539108df5b401 (patch)
tree84712c7506ffa22b320623046f07e8caf3125525 /tests
parenta8db913b7144dbcdbe479f32c12c4dd8c21e0675 (diff)
tests: scenarios for rsync's units and pass changes
rsync-units checks that rsync's log gives sizes in units of 1024, as --out-format asks for. pass-changes checks that a pass source gets decrypted again when its store changes, and only then.
Diffstat (limited to 'tests')
-rw-r--r--tests/scenarios.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/scenarios.nix b/tests/scenarios.nix
index 362a854..9f1e037 100644
--- a/tests/scenarios.nix
+++ b/tests/scenarios.nix
@@ -1176,6 +1176,18 @@ assert !(krops.isLocalTarget (targets.remote "/"));
expect.fail = "error: flake /fixtures/top has no input nope";
}];
})
+ # rsync's log gives sizes in units of 1024, as %'''l asks for.
+ (s "rsync-units" {
+ prepareDeployer = ''
+ rm -fR /tmp/rsync-units
+ mkdir /tmp/rsync-units
+ head -c 2048 /dev/zero > /tmp/rsync-units/f
+ '';
+ phases = [{
+ sources.x.file = "/tmp/rsync-units";
+ output = [ "/2.00K" ];
+ }];
+ })
# A pipe command without #!, which a shell runs as a script.
(s "pipe-script" {
prepareDeployer = ''
@@ -1189,6 +1201,45 @@ assert !(krops.isLocalTarget (targets.remote "/"));
'';
}];
})
+ # A pass source gets decrypted again only when the last commit of its
+ # passwords changes, which .pass_info records.
+ (s "pass-changes" (let
+ sources.x.pass = { dir = "/tmp/pass-changes"; name = "x"; };
+ in {
+ prepareDeployer = ''
+ rm -fR /tmp/pass-changes
+ cp -R /fixtures/pass-git /tmp/pass-changes
+ '';
+ phases = [
+ {
+ inherit sources;
+ check = ''
+ expect_eq a "$(cat "$T"/x/a)" secret-a
+ '';
+ mutate = ''
+ echo local-change > "$T"/x/a
+ '';
+ }
+ {
+ inherit sources;
+ check = ''
+ expect_eq a "$(cat "$T"/x/a)" local-change
+ '';
+ mutateDeployer = ''
+ export GIT_AUTHOR_NAME=krops GIT_AUTHOR_EMAIL=spam@krebsco.de
+ export GIT_COMMITTER_NAME=krops GIT_COMMITTER_EMAIL=spam@krebsco.de
+ printf 'secret-b\n' |
+ PASSWORD_STORE_DIR=/tmp/pass-changes pass insert -m -f x/a >/dev/null
+ '';
+ }
+ {
+ inherit sources;
+ check = ''
+ expect_eq a "$(cat "$T"/x/a)" secret-b
+ '';
+ }
+ ];
+ }))
# An input locked to a path the target doesn't have.
(s "gone" {
phases = [{