diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-01-09 14:33:05 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-01-09 14:33:05 +0100 |
| commit | edbd1f52c44ba6ee9a290146f714453fc87e689d (patch) | |
| tree | 0118ae5c08ebf94026708479e500954eda8ce2d2 | |
| parent | 5d0bcc201050c90353418d3413a92e692ae3faee (diff) | |
| parent | e92eb7aaa1f354726191cd04477e586c6bc8a50d (diff) | |
| download | mullvadvpn-edbd1f52c44ba6ee9a290146f714453fc87e689d.tar.xz mullvadvpn-edbd1f52c44ba6ee9a290146f714453fc87e689d.zip | |
Merge branch 'testing-fail-if-ssh-setup-fails'
| -rw-r--r-- | test/Cargo.lock | 6 | ||||
| -rw-r--r-- | test/scripts/ssh-setup.sh | 7 | ||||
| -rw-r--r-- | test/test-manager/src/vm/provision.rs | 11 |
3 files changed, 18 insertions, 6 deletions
diff --git a/test/Cargo.lock b/test/Cargo.lock index b2fc6bcb73..484b256cac 100644 --- a/test/Cargo.lock +++ b/test/Cargo.lock @@ -3110,7 +3110,7 @@ dependencies = [ [[package]] name = "test-manager" -version = "0.1.0" +version = "0.0.0" dependencies = [ "anyhow", "async-tempfile", @@ -3179,7 +3179,7 @@ dependencies = [ [[package]] name = "test-runner" -version = "0.1.0" +version = "0.0.0" dependencies = [ "bytes", "chrono", @@ -3211,7 +3211,7 @@ dependencies = [ [[package]] name = "test_macro" -version = "0.1.0" +version = "0.0.0" dependencies = [ "proc-macro2", "quote", diff --git a/test/scripts/ssh-setup.sh b/test/scripts/ssh-setup.sh index 4aefcfdeed..bfe0b66f12 100644 --- a/test/scripts/ssh-setup.sh +++ b/test/scripts/ssh-setup.sh @@ -106,5 +106,8 @@ fi setup_systemd # Install required packages -which apt &>/dev/null && apt install -f xvfb wireguard-tools -which dnf &>/dev/null && dnf install -y xorg-x11-server-Xvfb wireguard-tools +if which apt &>/dev/null; then + apt install -f xvfb wireguard-tools +elif which dnf &>/dev/null; then + dnf install -y xorg-x11-server-Xvfb wireguard-tools +fi diff --git a/test/test-manager/src/vm/provision.rs b/test/test-manager/src/vm/provision.rs index b3b39a2c18..5f01e8f192 100644 --- a/test/test-manager/src/vm/provision.rs +++ b/test/test-manager/src/vm/provision.rs @@ -1,6 +1,6 @@ use crate::config::{OsType, Provisioner, VmConfig}; use crate::package; -use anyhow::{Context, Result}; +use anyhow::{bail, Context, Result}; use ssh2::Session; use std::fs::File; use std::io::{self, Read}; @@ -203,5 +203,14 @@ fn ssh_exec(session: &Session, command: &str) -> Result<String> { channel.send_eof()?; channel.wait_eof()?; channel.wait_close()?; + + let exit_status = channel + .exit_status() + .context("Failed to obtain exit status")?; + if exit_status != 0 { + log::error!("command failed: {command}\n{output}"); + bail!("command failed: {exit_status}"); + } + Ok(output) } |
