Skip to content

Commit edbd1f5

Browse files
committed
Merge branch 'testing-fail-if-ssh-setup-fails'
2 parents 5d0bcc2 + e92eb7a commit edbd1f5

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

test/Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/scripts/ssh-setup.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,8 @@ fi
106106
setup_systemd
107107

108108
# Install required packages
109-
which apt &>/dev/null && apt install -f xvfb wireguard-tools
110-
which dnf &>/dev/null && dnf install -y xorg-x11-server-Xvfb wireguard-tools
109+
if which apt &>/dev/null; then
110+
apt install -f xvfb wireguard-tools
111+
elif which dnf &>/dev/null; then
112+
dnf install -y xorg-x11-server-Xvfb wireguard-tools
113+
fi

test/test-manager/src/vm/provision.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::config::{OsType, Provisioner, VmConfig};
22
use crate::package;
3-
use anyhow::{Context, Result};
3+
use anyhow::{bail, Context, Result};
44
use ssh2::Session;
55
use std::fs::File;
66
use std::io::{self, Read};
@@ -203,5 +203,14 @@ fn ssh_exec(session: &Session, command: &str) -> Result<String> {
203203
channel.send_eof()?;
204204
channel.wait_eof()?;
205205
channel.wait_close()?;
206+
207+
let exit_status = channel
208+
.exit_status()
209+
.context("Failed to obtain exit status")?;
210+
if exit_status != 0 {
211+
log::error!("command failed: {command}\n{output}");
212+
bail!("command failed: {exit_status}");
213+
}
214+
206215
Ok(output)
207216
}

0 commit comments

Comments
 (0)