git.iko.soy/typeable/nixpkgs
on master help sign in
installers/tools: add test for system.disableInstallerTools option

This test ensures the installer tools are actually unavailable with the option set to true.

commit92139c204542aaa10b719eeeca9a7e200df901aa authori-do-cpp <62053234+i-do-cpp@users.noreply.github.com> dateSun 12 Sep 2021, 08:06 (5 years ago) parent82ebf26
2 files changed+30
nixos/tests/all-tests.nix+1 nixos/tests/disable-installer-tools.nix+29
nixos/tests/all-tests.nix+1
@@ -98,6 +98,7 @@ in
9898 deluge = handleTest ./deluge.nix {};
9999 dendrite = handleTest ./dendrite.nix {};
100100 dhparams = handleTest ./dhparams.nix {};
101+ disable-installer-tools = handleTest ./disable-installer-tools.nix {};
101102 discourse = handleTest ./discourse.nix {};
102103 dnscrypt-proxy2 = handleTestOn ["x86_64-linux"] ./dnscrypt-proxy2.nix {};
103104 dnscrypt-wrapper = handleTestOn ["x86_64-linux"] ./dnscrypt-wrapper {};
nixos/tests/disable-installer-tools.nixnew file+29
@@ -0,0 +1,29 @@
1+import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
2+
3+{
4+ name = "disable-installer-tools";
5+
6+ machine =
7+ { pkgs, lib, ... }:
8+ {
9+ system.disableInstallerTools = true;
10+ boot.enableContainers = false;
11+ environment.defaultPackages = [];
12+ };
13+
14+ testScript = ''
15+ machine.wait_for_unit("multi-user.target")
16+ machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
17+
18+ with subtest("nixos installer tools should not be included"):
19+ machine.fail("which nixos-rebuild")
20+ machine.fail("which nixos-install")
21+ machine.fail("which nixos-generate-config")
22+ machine.fail("which nixos-enter")
23+ machine.fail("which nixos-version")
24+ machine.fail("which nixos-build-vms")
25+
26+ with subtest("perl should not be included"):
27+ machine.fail("which perl")
28+ '';
29+})