Skip to content

Commit b06713b

Browse files
parzivaleclaude
andcommitted
tests: strengthen service tests with meaningful runtime assertions
Replace bare "is running" checks with config file presence, socket existence, CLI tool invocations, state directory checks, and HTTP health probes where applicable. nvidia-persistenced/powerd drop the running check entirely (requires real GPU hardware). jellyfin drops the HTTP check (SIGABRT on aarch64 QEMU). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 11218d2 commit b06713b

33 files changed

Lines changed: 114 additions & 7 deletions

File tree

modules/services/accounts-daemon/test.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
testScript = ''
1313
machine.start()
1414
machine.wait_for_console_text("entering runlevel 2")
15+
1516
with subtest("accounts-daemon is running"):
1617
machine.wait_until_succeeds("initctl status accounts-daemon | grep running", timeout=30)
18+
19+
with subtest("AccountsService state directory exists"):
20+
machine.succeed("test -d /var/lib/AccountsService")
21+
1722
machine.shutdown()
1823
'';
1924
};

modules/services/bluetooth/test.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
with subtest("bluetooth is running"):
1717
machine.wait_until_succeeds("initctl status bluetooth | grep running", timeout=30)
1818
19+
with subtest("bluetooth config is installed"):
20+
machine.succeed("test -f /etc/bluetooth/main.conf")
21+
1922
machine.shutdown()
2023
'';
2124
};

modules/services/dbus/test.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
with subtest("dbus is running"):
1616
machine.wait_until_succeeds("initctl status dbus | grep running", timeout=30)
1717
18+
with subtest("dbus system socket exists"):
19+
machine.succeed("test -S /run/dbus/system_bus_socket")
20+
1821
machine.shutdown()
1922
'';
2023
};

modules/services/docker/test.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
with subtest("docker is running"):
1616
machine.wait_until_succeeds("initctl status docker | grep running", timeout=30)
1717
18+
with subtest("docker daemon config is installed"):
19+
machine.succeed("test -f /etc/docker/daemon.json")
20+
21+
with subtest("docker socket exists"):
22+
machine.wait_until_succeeds("test -S /run/docker.sock", timeout=30)
23+
1824
machine.shutdown()
1925
'';
2026
};

modules/services/earlyoom/test.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
with subtest("earlyoom is running"):
1616
machine.wait_until_succeeds("initctl status earlyoom | grep running", timeout=30)
1717
18+
with subtest("earlyoom finit service is configured"):
19+
machine.succeed("test -f /etc/finit.d/earlyoom.conf")
20+
1821
machine.shutdown()
1922
'';
2023
};

modules/services/elogind/test.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
with subtest("elogind is running"):
1717
machine.wait_until_succeeds("initctl status elogind | grep running", timeout=30)
1818
19+
with subtest("elogind config is installed"):
20+
machine.succeed("test -f /etc/elogind/logind.conf")
21+
22+
with subtest("loginctl is usable"):
23+
machine.succeed("loginctl list-sessions")
24+
1925
machine.shutdown()
2026
'';
2127
};

modules/services/flatpak/test.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
with subtest("flatpak binary is available"):
1717
machine.succeed("flatpak --version")
1818
19+
with subtest("flatpak user and group exist"):
20+
machine.succeed("id flatpak")
21+
machine.succeed("getent group flatpak")
22+
1923
machine.shutdown()
2024
'';
2125
};

modules/services/fwupd/test.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
with subtest("fwupd is running"):
1818
machine.wait_until_succeeds("initctl status fwupd | grep running", timeout=60)
1919
20+
with subtest("fwupd config is installed"):
21+
machine.succeed("test -f /etc/fwupd/fwupd.conf")
22+
2023
machine.shutdown()
2124
'';
2225
};

modules/services/greetd/test.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
with subtest("greetd is running"):
1717
machine.wait_until_succeeds("initctl status greetd | grep running", timeout=30)
1818
19+
with subtest("greetd greeter cache directory exists"):
20+
machine.succeed("test -d /var/cache/tuigreet")
21+
1922
machine.shutdown()
2023
'';
2124
};

modules/services/illum/test.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
with subtest("illum is running"):
1616
machine.wait_until_succeeds("initctl status illum | grep running", timeout=30)
1717
18+
with subtest("illum finit service is configured"):
19+
machine.succeed("test -f /etc/finit.d/illum.conf")
20+
1821
machine.shutdown()
1922
'';
2023
};

0 commit comments

Comments
 (0)