diff options
| author | tv <tv@krebsco.de> | 2026-12-01 03:50:16 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-01 03:50:25 +0000 |
| commit | 75df988e1cb9863ee5d708dbc578f7690bb182de (patch) | |
| tree | 552afe68563d330888a1f06dfac87cc8339608df /pkgs/populate/tests/scenarios.nix | |
| parent | 5df6e41e05b9449a964467bc11a9d7fce2d802ec (diff) | |
populate pipe: directory, a directory the command makes
A pipe source's command printed a file. With directory set, it gets an
empty directory as its first argument, mode 0700 in populate's temporary
directory, which populate removes afterwards, and fills it, and populate
delivers what it made there, with the modes it has, e.g. secrets with
mode 0600 under 0700, and the fixed time of pipe's output, compared by
checksum. Secrets that should stay in memory can go to a target
directory of their own, e.g. in /run, with a populate run of its own.
The scenario pipe-directory checks the modes, and that a changed
directory gets mirrored, removing what's not in it anymore.
Diffstat (limited to 'pkgs/populate/tests/scenarios.nix')
| -rw-r--r-- | pkgs/populate/tests/scenarios.nix | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/pkgs/populate/tests/scenarios.nix b/pkgs/populate/tests/scenarios.nix index f7ece9a..dac8e6b 100644 --- a/pkgs/populate/tests/scenarios.nix +++ b/pkgs/populate/tests/scenarios.nix @@ -468,7 +468,40 @@ in expect_eq x "$(cat "$T"/x)" piped ''; }; - }); + }) + # A directory the command makes: delivered with the modes it has, and + # mirrored, when what the command makes changes. + ++ map (targetKind: scenario (let + sources.x.pipe = { command = "/fixtures/pipe-dir"; directory = true; }; + secret = value: '' + expect_eq secret "$(cat "$T"/x/sub/deep/secret)" ${value} + expect_eq modes "$(stat -c %a "$T"/x "$T"/x/sub "$T"/x/sub/deep "$T"/x/sub/deep/secret | paste -s -d ' ' -)" "700 700 700 600" + ''; + in { + name = "pipe-directory-${targetKind}"; + inherit targetKind; + prepareDeployer = '' + echo one > /fixtures/pipe-dir-data + ''; + phases = [ + { + inherit sources; + check = secret "one"; + mutate = '' + echo stray > "$T"/x/stray + ''; + mutateDeployer = '' + echo two > /fixtures/pipe-dir-data + ''; + } + { + inherit sources; + check = secret "two" + '' + test ! -e "$T"/x/stray || fail "stray not removed" + ''; + } + ]; + })) targetKinds; symlink = matrix "symlink" { absolute = [ false true ]; |
