aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/scenarios.nix9
-rw-r--r--tests/vm.nix5
2 files changed, 12 insertions, 2 deletions
diff --git a/tests/scenarios.nix b/tests/scenarios.nix
index 43b63b4..e01c5a9 100644
--- a/tests/scenarios.nix
+++ b/tests/scenarios.nix
@@ -109,10 +109,12 @@ let
# evaluation fail. env sets environment variables for populate, as
# arguments of env. interrupt ends populate after that many seconds,
# which it's expected not to finish before. output lists what a
- # succeeding populate is expected to print.
+ # succeeding populate is expected to print, and unexpected what populate
+ # is expected not to print, succeeding or not.
phase = {
sources, backup ? false, prune ? false, deploy ? null,
targetPath ? path, env ? "", interrupt ? null, output ? [],
+ unexpected ? [],
expect ? "success", control ? null, controlTargetPath ? null,
check ? "", mutate ? null, checkDeployer ? null, mutateDeployer ? null,
}: let
@@ -147,7 +149,7 @@ let
null
else {
populate = toString (command sources targetPath);
- inherit env interrupt output;
+ inherit env interrupt output unexpected;
expect = if expect == "success" then null else expect.fail;
# No phase gets around checking the canaries.
check = script (check + "\ncanary_check\n");
@@ -1258,6 +1260,9 @@ assert !(krops.isLocalTarget (targets.remote "/"));
p.pipe = "/fixtures/pipe";
};
expect.fail = "error: source p is not a directory";
+ # Locking the flake with an empty URL would lock the current
+ # directory, the login directory on a remote target.
+ unexpected = [ "while fetching the input" ];
}];
})
(s "noinput-nested" {
diff --git a/tests/vm.nix b/tests/vm.nix
index d7b2f60..7c362f5 100644
--- a/tests/vm.nix
+++ b/tests/vm.nix
@@ -158,6 +158,11 @@ in pkgs.testers.runNixOSTest {
f"env HOME=/root {phase['env']} timeout {limit} {phase['populate']} </dev/null 2>&1",
timeout=900,
)
+ for unexpected in phase["unexpected"]:
+ if unexpected in out:
+ raise Exception(
+ f"populate {i} prints {unexpected!r}:\n{out}"
+ )
if phase["interrupt"] is not None:
if status != 124:
raise Exception(f"populate {i} ends on its own:\n{out}")