Skip to content

Commit 7f41ace

Browse files
committed
tests/default.nix: add interactive test driver app
1 parent 9cde550 commit 7f41ace

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

flake.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,12 @@
1919
{
2020
formatter = eachDefaultSystem (system: inputs.nixpkgs.legacyPackages.${system}.nixfmt-tree);
2121
checks = eachDefaultSystem (system: import ./tests { inherit inputs system; });
22+
apps = eachDefaultSystem (
23+
system:
24+
import ./tests {
25+
inherit inputs system;
26+
interactive = true;
27+
}
28+
);
2229
};
2330
}

tests/default.nix

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
inputs,
33
system,
4+
interactive ? false,
45
}:
56
let
67
inherit (inputs) nixpkgs;
@@ -26,19 +27,26 @@ builtins.listToAttrs (
2627
pkgs
2728
;
2829
};
30+
driver = pkgs.testers.runNixOSTest (
31+
lib.recursiveUpdate {
32+
interactive = {
33+
sshBackdoor.enable = true;
34+
nodes = lib.listToAttrs (
35+
map (name: {
36+
inherit name;
37+
value.virtualisation.graphics = false;
38+
}) (builtins.attrNames test.nodes)
39+
);
40+
};
41+
} test
42+
);
2943
in
30-
pkgs.testers.runNixOSTest (
31-
lib.recursiveUpdate {
32-
interactive = {
33-
sshBackdoor.enable = true;
34-
nodes = lib.listToAttrs (
35-
map (name: {
36-
inherit name;
37-
value.virtualisation.graphics = false;
38-
}) (builtins.attrNames test.nodes)
39-
);
40-
};
41-
} test
42-
);
44+
if interactive then
45+
{
46+
type = "app";
47+
program = "${driver.driverInteractive}/bin/nixos-test-driver";
48+
}
49+
else
50+
driver;
4351
}) tests
4452
)

0 commit comments

Comments
 (0)