diff options
author | i-do-cpp <62053234+i-do-cpp@users.noreply.github.com> | 2021-09-12 08:06:34 +0200 |
---|---|---|
committer | i-do-cpp <62053234+i-do-cpp@users.noreply.github.com> | 2021-09-15 09:18:35 +0200 |
commit | 92139c204542aaa10b719eeeca9a7e200df901aa (patch) | |
tree | 9e3b9a5a2e6b7472156f67ac8d279785f21f8752 | |
parent | 82ebf26237f9812463a57b5543e3490675f1944b (diff) | |
download | nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.tar nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.tar.gz nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.tar.bz2 nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.tar.lz nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.tar.xz nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.tar.zst nixpkgs-92139c204542aaa10b719eeeca9a7e200df901aa.zip |
installers/tools: add test for system.disableInstallerTools option
This test ensures the installer tools are actually unavailable with the option set to true.
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/disable-installer-tools.nix | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index dab99dd8d04..606440479f7 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -98,6 +98,7 @@ in deluge = handleTest ./deluge.nix {}; dendrite = handleTest ./dendrite.nix {}; dhparams = handleTest ./dhparams.nix {}; + disable-installer-tools = handleTest ./disable-installer-tools.nix {}; discourse = handleTest ./discourse.nix {}; dnscrypt-proxy2 = handleTestOn ["x86_64-linux"] ./dnscrypt-proxy2.nix {}; dnscrypt-wrapper = handleTestOn ["x86_64-linux"] ./dnscrypt-wrapper {}; diff --git a/nixos/tests/disable-installer-tools.nix b/nixos/tests/disable-installer-tools.nix new file mode 100644 index 00000000000..23c15faa8d3 --- /dev/null +++ b/nixos/tests/disable-installer-tools.nix @@ -0,0 +1,29 @@ +import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }: + +{ + name = "disable-installer-tools"; + + machine = + { pkgs, lib, ... }: + { + system.disableInstallerTools = true; + boot.enableContainers = false; + environment.defaultPackages = []; + }; + + testScript = '' + machine.wait_for_unit("multi-user.target") + machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'") + + with subtest("nixos installer tools should not be included"): + machine.fail("which nixos-rebuild") + machine.fail("which nixos-install") + machine.fail("which nixos-generate-config") + machine.fail("which nixos-enter") + machine.fail("which nixos-version") + machine.fail("which nixos-build-vms") + + with subtest("perl should not be included"): + machine.fail("which perl") + ''; +}) |