Skip to content

Commit ed70f00

Browse files
committed
systemd-initrd: migrate test to runTest and add comment for syntax highlighting of test script
1 parent 01b589a commit ed70f00

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ in
12961296
systemd-initrd-luks-unl0kr = handleTest ./systemd-initrd-luks-unl0kr.nix { };
12971297
systemd-initrd-modprobe = handleTest ./systemd-initrd-modprobe.nix { };
12981298
systemd-initrd-shutdown = handleTest ./systemd-shutdown.nix { systemdStage1 = true; };
1299-
systemd-initrd-simple = handleTest ./systemd-initrd-simple.nix { };
1299+
systemd-initrd-simple = runTest ./systemd-initrd-simple.nix;
13001300
systemd-initrd-swraid = handleTest ./systemd-initrd-swraid.nix { };
13011301
systemd-initrd-vconsole = handleTest ./systemd-initrd-vconsole.nix { };
13021302
systemd-initrd-networkd = handleTest ./systemd-initrd-networkd.nix { };

nixos/tests/systemd-initrd-simple.nix

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import ./make-test-python.nix (
2-
{ lib, pkgs, ... }:
3-
{
4-
name = "systemd-initrd-simple";
5-
6-
nodes.machine =
7-
{ pkgs, ... }:
8-
{
9-
testing.initrdBackdoor = true;
10-
boot.initrd.systemd.enable = true;
11-
virtualisation.fileSystems."/".autoResize = true;
12-
};
13-
14-
testScript = ''
1+
{
2+
name = "systemd-initrd-simple";
3+
4+
nodes.machine =
5+
{ pkgs, ... }:
6+
{
7+
testing.initrdBackdoor = true;
8+
boot.initrd.systemd.enable = true;
9+
virtualisation.fileSystems."/".autoResize = true;
10+
};
11+
12+
testScript =
13+
# python
14+
''
1515
import subprocess
1616
1717
with subtest("testing initrd backdoor"):
@@ -54,5 +54,4 @@ import ./make-test-python.nix (
5454
with subtest("no warnings from systemd about write permissions"):
5555
machine.fail("journalctl -b 0 | grep 'is marked world-writable, which is a security risk as it is executed with privileges'")
5656
'';
57-
}
58-
)
57+
}

0 commit comments

Comments
 (0)