WIP: test data model thru VM #11

Closed
kiara wants to merge 70 commits from data-model-test-deployment-plain into deployment-data-model-with-tests
Showing only changes of commit 03cbb4738d - Show all commits

View file

@ -122,14 +122,27 @@ in
sshOpts=( sshOpts=(
-o BatchMode=yes -o BatchMode=yes
-o StrictHostKeyChecking=no -o StrictHostKeyChecking=no
-o "ConnectionAttempts=1"
-o "ConnectTimeout=1"
-o "ServerAliveCountMax=1"
-o "ServerAliveInterval=1"
) )
# get the realized derivation to deploy # get the realized derivation to deploy
outPath=$(nix-store --realize "$drv_path") outPath=$(nix-store --realize "$drv_path")
# deploy the config by nix-copy-closure # deploy the config by nix-copy-closure
NIX_SSHOPTS="''${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes NIX_SSHOPTS="''${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
# switch the remote host to the config # switch the remote host to the config
ssh "''${sshOpts[@]}" "$host" "nix-env --profile /nix/var/nix/profiles/system --set $outPath; $outPath/bin/switch-to-configuration switch" output=$(ssh "''${sshOpts[@]}" "$host" "nix-env --profile /nix/var/nix/profiles/system --set $outPath; nohup $outPath/bin/switch-to-configuration switch &" 2>&1) || echo "status code: $?"
echo "output: $output"
if [[ $output != *"Timeout, server ${nodeName} not responding"* ]]; then
echo "non-timeout error: $output"
exit 1
else
exit 0
fi
""") """)
${nodeName}.wait_for_unit("multi-user.target")
${nodeName}.succeed("systemctl is-active sshd")
${nodeName}.succeed("${nodeName} 1>&2") ${nodeName}.succeed("${nodeName} 1>&2")
'') targetMachines '') targetMachines
)} )}