diff options
| author | tv <tv@krebsco.de> | 2026-11-12 20:48:11 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-13 03:24:36 +0100 |
| commit | 8c78f328bf7a1a4b97f26e5f5bb25f2d8b462f24 (patch) | |
| tree | 3f7dfb0c2fecdb09efd87bc1293d25d0bc4b8579 /tests/default.nix | |
| parent | bde412b675588ec14bf069f7e244b6e34eb5fdff (diff) | |
tests: check output, test rsync versions, close gaps in what's asserted
Several checks would pass with the feature they cover broken, or cover
it only by chance:
- Phases can state what a succeeding populate prints. That covers the
warnings of insecureLinks, the lines pruning prints, the one about a
replaced symlink, and what rsync logs about each item.
- The insecureLinks scenarios take their expectations from the version of
rsync, so with an rsync older than 3.5.0 they pass without the check
ever running. New tests, rsync-3-4-1 and rsync-3-5-0, run them with
these versions, which tests/rsync.nix builds from their release
tarballs, with ACLs and extended attributes, which backups use.
- Pruning has a leftover upload to remove, and a source that stops
having inputs to root leaves no empty directory of roots.
- A full clone has every commit from the start, so the fetch for a commit
it lacks never runs. A git scenario deploys a commit that appears on
the server after cloning.
- The jq test also runs the Nix function that finds a flake's
subdirectory on the target, over both shapes of nix flake metadata's
output.
Diffstat (limited to 'tests/default.nix')
| -rw-r--r-- | tests/default.nix | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/tests/default.nix b/tests/default.nix index 7b82bce..3dabee9 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,29 +11,55 @@ let gitHead = "e42d44ef9cdb76ba5a84dff4c89c38222703bf0c"; gitFirst = "8d47013fa0888948cf0ffcc4e3c69a7b5f180562"; - scenarios = import ./scenarios.nix { + # rsync versions the scenarios depending on rsync's version run with. + # callPackage adds override and overrideDerivation, which aren't versions. + rsyncs = pkgs.lib.filterAttrs + (_: pkgs.lib.isDerivation) + (pkgs.callPackage ./rsync.nix {}); + + # The scenarios, with populate using rsync. + scenariosWith = rsync: import ./scenarios.nix { inherit (pkgs) lib; krops = import ../lib; - inherit (pkgs) populate; + populate = pkgs.populate.override { inherit rsync; }; inherit (pkgs.krops) writeDeploy; url = "http://deployer:8000"; gitUrl = "git://deployer/gitsrc.git"; remoteHost = "target"; agePath = "${pkgs.age}/bin/age"; inherit gitHead gitFirst; - rsyncVersion = pkgs.rsync.version; + rsyncVersion = rsync.version; }; + scenarios = scenariosWith pkgs.rsync; flakeJq = import ../pkgs/populate/flake-jq.nix; in builtins.mapAttrs (name: scenarios: import ./vm.nix { inherit pkgs name scenarios gitHead; }) scenarios + // pkgs.lib.mapAttrs' + (version: rsync: { + name = "rsync-${builtins.replaceStrings [ "." ] [ "-" ] version}"; + value = import ./vm.nix { + inherit pkgs gitHead rsync; + name = "rsync-${version}"; + scenarios = builtins.filter + (scenario: pkgs.lib.hasInfix "insecureLinks" scenario.name) + (scenariosWith rsync).file; + }; + }) + rsyncs // { # Lock files in the shapes different versions of Nix write. - jq = pkgs.runCommand "krops-jq" { nativeBuildInputs = [ pkgs.jq ]; } '' + jq = pkgs.runCommand "krops-jq" { + nativeBuildInputs = [ pkgs.jq pkgs.nix ]; + } '' sh ${./jq.sh} ${pkgs.linkFarm "krops-flake-jq" (map (name: { name = "${name}.jq"; path = pkgs.writeText "${name}.jq" flakeJq.${name}; }) - [ "selected" "selfIsRemote" "selfLocked" ])} + [ "selected" "selfIsRemote" "selfLocked" ] + ++ [{ + name = "metadataSubdir.nix"; + path = pkgs.writeText "metadataSubdir.nix" flakeJq.metadataSubdir; + }])} touch $out ''; } |
