at 21.11-pre 1.0 kB view raw
1# Test configuration switching. 2 3import ./make-test-python.nix ({ pkgs, ...} : { 4 name = "switch-test"; 5 meta = with pkgs.lib.maintainers; { 6 maintainers = [ gleber ]; 7 }; 8 9 nodes = { 10 machine = { ... }: { 11 users.mutableUsers = false; 12 }; 13 other = { ... }: { 14 users.mutableUsers = true; 15 }; 16 }; 17 18 testScript = {nodes, ...}: let 19 originalSystem = nodes.machine.config.system.build.toplevel; 20 otherSystem = nodes.other.config.system.build.toplevel; 21 22 # Ensures failures pass through using pipefail, otherwise failing to 23 # switch-to-configuration is hidden by the success of `tee`. 24 stderrRunner = pkgs.writeScript "stderr-runner" '' 25 #! ${pkgs.runtimeShell} 26 set -e 27 set -o pipefail 28 exec env -i "$@" | tee /dev/stderr 29 ''; 30 in '' 31 machine.succeed( 32 "${stderrRunner} ${originalSystem}/bin/switch-to-configuration test" 33 ) 34 machine.succeed( 35 "${stderrRunner} ${otherSystem}/bin/switch-to-configuration test" 36 ) 37 ''; 38})