From 211e2d738bbb9b19ce873203e8bc72c832072e15 Mon Sep 17 00:00:00 2001 From: Janne Heß Date: Wed, 13 Sep 2023 16:56:01 +0200 Subject: nixos/switchTest: Also test init interface version --- nixos/tests/switch-test.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/tests/switch-test.nix b/nixos/tests/switch-test.nix index 7be0b4c7d3c..ef50f93eee8 100644 --- a/nixos/tests/switch-test.nix +++ b/nixos/tests/switch-test.nix @@ -58,6 +58,10 @@ in { ''); specialisation = rec { + brokenInitInterface.configuration.config.system.extraSystemBuilderCmds = '' + echo "systemd 0" > $out/init-interface-version + ''; + simpleService.configuration = { systemd.services.test = { wantedBy = [ "multi-user.target" ]; @@ -646,7 +650,11 @@ in { # invalid action fails the script switch_to_specialisation("${machine}", "", action="broken-action", fail=True) # no action fails the script - "Usage:" in machine.fail("${machine}/bin/switch-to-configuration") + assert "Usage:" in machine.fail("${machine}/bin/switch-to-configuration 2>&1") + + with subtest("init interface version"): + # Do not try to switch to an invalid init interface version + assert "incompatible" in switch_to_specialisation("${machine}", "brokenInitInterface", fail=True) with subtest("services"): switch_to_specialisation("${machine}", "") -- cgit 1.4.1