Skip to content

Commit 25bbc24

Browse files
committed
nixosTests: extract disko-install-menu tests into extra file
1 parent 2b043fd commit 25bbc24

3 files changed

Lines changed: 68 additions & 49 deletions

File tree

nix/checks/nixosTests/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
_class = "flake";
77

8+
imports = [
9+
./diskoInstallMenu.nix
10+
];
11+
812
perSystem =
913
{ importWithSystem, ... }@systemArg:
1014
{
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
inputs,
3+
self,
4+
...
5+
}:
6+
{
7+
_class = "flake";
8+
perSystem =
9+
{ pkgs, ... }:
10+
{
11+
checks = {
12+
13+
# similar to disko-install-menu.checks.SYSTEM.offineBuilds-*
14+
# (TODO in disko-install-menu, export test framework & use here)
15+
diskoOfflineInstall = pkgs.testers.runNixOSTest {
16+
name = "diskoOfflineInstall";
17+
# similar as above: allow customizations with overlays
18+
node.pkgsReadOnly = false;
19+
nodes.node.imports = [
20+
inputs.disko-install-menu.nixosModules.default
21+
{
22+
programs.disko-install-menu = {
23+
enable = true;
24+
offlineCapable = true;
25+
options = {
26+
defaultFlake = "${self}";
27+
defaultHost = "empty";
28+
};
29+
listedFlakes.defaultFlake = {
30+
offlineHosts.empty = true;
31+
offlineReference = self;
32+
};
33+
};
34+
virtualisation = {
35+
memorySize = 4 * 1024;
36+
useNixStoreImage = true; # verify that installer can run with all detected dependencies (see https://github.com/NixOS/nix/issues/14207)
37+
writableStore = true;
38+
};
39+
}
40+
# make offlineCapable tests fail more likely when installer config is designed more minimalistically
41+
{
42+
xdg.mime.enable = false;
43+
}
44+
./../../offlineInstallDeps.nix
45+
];
46+
testScript = ''
47+
node.start()
48+
node.wait_for_unit("default.target")
49+
50+
# ensure offline
51+
node.block()
52+
node.execute("ip -4 route del default")
53+
node.execute("ip -6 route del default")
54+
node.fail("ping -c 2 9.9.9.9")
55+
node.fail("ping -c 2 2620:fe::fe")
56+
57+
# execute build
58+
node.succeed("disko-install-menu --debug-test-build")
59+
'';
60+
};
61+
62+
};
63+
};
64+
}

nix/checks/nixosTests/legacy.nix

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -64,55 +64,6 @@ in
6464
'';
6565
};
6666

67-
# similar to disko-install-menu.checks.SYSTEM.offineBuilds-*
68-
# (TODO in disko-install-menu, export test framework & use here)
69-
diskoOfflineInstall = pkgs.testers.runNixOSTest {
70-
name = "diskoOfflineInstall";
71-
# similar as above: allow customizations with overlays
72-
node.pkgsReadOnly = false;
73-
nodes.node.imports = [
74-
inputs.disko-install-menu.nixosModules.default
75-
{
76-
programs.disko-install-menu = {
77-
enable = true;
78-
offlineCapable = true;
79-
options = {
80-
defaultFlake = "${self}";
81-
defaultHost = "empty";
82-
};
83-
listedFlakes.defaultFlake = {
84-
offlineHosts.empty = true;
85-
offlineReference = self;
86-
};
87-
};
88-
virtualisation = {
89-
memorySize = 4 * 1024;
90-
useNixStoreImage = true; # verify that installer can run with all detected dependencies (see https://github.com/NixOS/nix/issues/14207)
91-
writableStore = true;
92-
};
93-
}
94-
# make offlineCapable tests fail more likely when installer config is designed more minimalistically
95-
{
96-
xdg.mime.enable = false;
97-
}
98-
./../../offlineInstallDeps.nix
99-
];
100-
testScript = ''
101-
node.start()
102-
node.wait_for_unit("default.target")
103-
104-
# ensure offline
105-
node.block()
106-
node.execute("ip -4 route del default")
107-
node.execute("ip -6 route del default")
108-
node.fail("ping -c 2 9.9.9.9")
109-
node.fail("ping -c 2 2620:fe::fe")
110-
111-
# execute build
112-
node.succeed("disko-install-menu --debug-test-build")
113-
'';
114-
};
115-
11667
dynamicIssue-module-sshHostKey = nixosTest {
11768
name = "dynamicIssue-module-sshHostKey";
11869
nodes.node = {

0 commit comments

Comments
 (0)