diff options
Diffstat (limited to 'pkgs/populate/tests/scenarios.nix')
| -rw-r--r-- | pkgs/populate/tests/scenarios.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/populate/tests/scenarios.nix b/pkgs/populate/tests/scenarios.nix index 7fa0964..96804f8 100644 --- a/pkgs/populate/tests/scenarios.nix +++ b/pkgs/populate/tests/scenarios.nix @@ -1118,6 +1118,60 @@ in } ]; }) + # File sources that rsync would find nothing to do for get skipped: + # neither break_hard_links nor rsync runs, so another hard link of a + # file stays. Each kind of difference makes them deliver again, which + # breaks it. x has filters, y none. + (s "file-skip" (let + sources = { + x.file = { + path = "/fixtures/filesrc"; + filters = [ { type = "exclude"; pattern = "skip-f"; } ]; + }; + y.file = "/fixtures/alt"; + }; + links = n: '' + expect_eq x-links "$(stat -c %h "$T"/x/keep)" ${toString n} + expect_eq y-links "$(stat -c %h "$T"/y/flake.nix)" ${toString n} + ''; + link = '' + ln -f "$T"/x/keep "$T"/x-keep + ln -f "$T"/y/flake.nix "$T"/y-flake + ''; + in { + phases = [ + { inherit sources; check = links 1; mutate = link; } + # Nothing to do, so the links stay. + { + inherit sources; + check = links 2; + mutate = '' + echo extra > "$T"/y/extra + touch -d @1 "$T"/x/keep + ''; + } + # A file too many, and a file's time. + { + inherit sources; + check = links 1 + '' + test ! -e "$T"/y/extra || fail "extra not deleted" + test "$(stat -c %Y "$T"/x/keep)" != 1 || fail "keep's time not restored" + ''; + mutate = link + '' + chmod 700 "$T"/y + echo excluded > "$T"/x/skip-f + ''; + } + # A directory's mode, and a file the filters exclude. + { + inherit sources; + check = links 1 + '' + test "$(stat -c %a "$T"/y)" != 700 || fail "y's mode not restored" + test ! -e "$T"/x/skip-f || fail "skip-f not deleted" + ''; + } + ]; + })) (s "cycle" { phases = [{ sources = { |
