summary refs log tree commit diff
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2023-09-13 16:56:01 +0200
committerJanne Heß <janne@hess.ooo>2023-09-13 16:56:01 +0200
commit211e2d738bbb9b19ce873203e8bc72c832072e15 (patch)
tree24b64b97e9032309d1a3ea8991c69c55c2b84b75
parentd1c1335908813fa659a02aa61222672b03b9239f (diff)
downloadnixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.tar
nixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.tar.gz
nixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.tar.bz2
nixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.tar.lz
nixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.tar.xz
nixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.tar.zst
nixpkgs-211e2d738bbb9b19ce873203e8bc72c832072e15.zip
nixos/switchTest: Also test init interface version
-rw-r--r--nixos/tests/switch-test.nix10
1 files changed, 9 insertions, 1 deletions
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}", "")