lol

nixos/switchTest: Also test swap devices

+24
+24
nixos/tests/switch-test.nix
··· 85 85 virtualisation.fileSystems."/".device = lib.mkForce "auto"; 86 86 }; 87 87 88 + swap.configuration.swapDevices = lib.mkVMOverride [ 89 + { device = "/swapfile"; size = 1; } 90 + ]; 91 + 88 92 simpleService.configuration = { 89 93 systemd.services.test = { 90 94 wantedBy = [ "multi-user.target" ]; ··· 736 740 out = switch_to_specialisation("${machine}", "storeMountModified") 737 741 assert_lacks(out, "stopping the following units:") 738 742 assert_contains(out, "NOT restarting the following changed units: -.mount") 743 + assert_contains(out, "reloading the following units: dbus.service\n") 744 + assert_lacks(out, "\nrestarting the following units:") 745 + assert_lacks(out, "\nstarting the following units:") 746 + assert_lacks(out, "the following new units were started:") 747 + 748 + with subtest("swaps"): 749 + switch_to_specialisation("${machine}", "") 750 + # add a swap 751 + out = switch_to_specialisation("${machine}", "swap") 752 + assert_lacks(out, "stopping the following units:") 753 + assert_lacks(out, "NOT restarting the following changed units:") 754 + assert_contains(out, "reloading the following units: dbus.service\n") 755 + assert_lacks(out, "\nrestarting the following units:") 756 + assert_lacks(out, "\nstarting the following units:") 757 + assert_contains(out, "the following new units were started: swapfile.swap") 758 + # remove it 759 + out = switch_to_specialisation("${machine}", "") 760 + assert_contains(out, "stopping swap device: /swapfile") 761 + assert_lacks(out, "stopping the following units:") 762 + assert_lacks(out, "NOT restarting the following changed units:") 739 763 assert_contains(out, "reloading the following units: dbus.service\n") 740 764 assert_lacks(out, "\nrestarting the following units:") 741 765 assert_lacks(out, "\nstarting the following units:")