summaryrefslogtreecommitdiffstats
path: root/nixos/lib/testing-python.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-08-13 17:35:30 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2021-08-13 17:39:49 +0200
commit1ba3f7927f9a8a982994ff6bdf1adc3949812128 (patch)
treef4cd88217f2aa0fb63db21c48a27dfaabf05f679 /nixos/lib/testing-python.nix
parente1ec5acd3137d3af247f9a938d9cc086d8111377 (diff)
nixos/testing: only create `nixos-run-vms` for `nixos-build-vms(8)`
This is the case when the test-script is empty. `nixos-build-vms(8)` is primarily supposed to be used as tool to test changes or to reproduce bugs (IMHO) where "just spinning up a few VMs" is the primary use-case. In the ongoing discussion about these changes[1] it was suggested to only expose it when needed (i.e. in the case I described above) to keep the API surface as slim as possible. [1] https://github.com/NixOS/nixpkgs/pull/133675#discussion_r688112485
Diffstat (limited to 'nixos/lib/testing-python.nix')
-rw-r--r--nixos/lib/testing-python.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index 070a3a7ddc21..e95ebe16ecac 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -187,11 +187,13 @@ rec {
--set testScript "$out/test-script" \
--set vlans '${toString vlans}'
- ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
- wrapProgram $out/bin/nixos-run-vms \
- --set startScripts "''${vmStartScripts[*]}" \
- --set testScript "${pkgs.writeText "start-all" "start_all(); join_all();"}" \
- --set vlans '${toString vlans}'
+ ${lib.optionalString (testScript == "") ''
+ ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
+ wrapProgram $out/bin/nixos-run-vms \
+ --set startScripts "''${vmStartScripts[*]}" \
+ --set testScript "${pkgs.writeText "start-all" "start_all(); join_all();"}" \
+ --set vlans '${toString vlans}'
+ ''}
'');
# Make a full-blown test