diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-09-04 20:27:21 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-09-05 07:54:14 +0200 |
| commit | 95cab9fe562dfc5d446227ef0a0e86be00dd30c9 (patch) | |
| tree | ad81fe7263684ef200e3e2674630fce889fcd7dc /test | |
| parent | 4491033d00a372d63d0d05459f44725991e54fb5 (diff) | |
| download | mullvadvpn-95cab9fe562dfc5d446227ef0a0e86be00dd30c9.tar.xz mullvadvpn-95cab9fe562dfc5d446227ef0a0e86be00dd30c9.zip | |
Add 'assume yes' to package installs in tests
Diffstat (limited to 'test')
| -rw-r--r-- | test/scripts/ssh-setup.sh | 6 | ||||
| -rw-r--r-- | test/test-runner/src/package.rs | 26 |
2 files changed, 19 insertions, 13 deletions
diff --git a/test/scripts/ssh-setup.sh b/test/scripts/ssh-setup.sh index dd72bca4f8..08887d4aba 100644 --- a/test/scripts/ssh-setup.sh +++ b/test/scripts/ssh-setup.sh @@ -129,15 +129,15 @@ robust_apt () { # We don't want to fail due to the global apt lock being # held, which happens sporadically. It is fine to wait for # some time if it means that the test run can continue. - apt -o DPkg::Lock::Timeout=60 "$@" + DEBIAN_FRONTEND=noninteractive apt-get -qy -o DPkg::Lock::Timeout=60 "$@" } function install_packages_apt { echo "Installing required apt packages" robust_apt update - robust_apt install -yf xvfb wireguard-tools curl + robust_apt install xvfb wireguard-tools curl if ! which ping &>/dev/null; then - robust_apt install -yf iputils-ping + robust_apt install iputils-ping fi curl -fsSL https://get.docker.com | sh } diff --git a/test/test-runner/src/package.rs b/test/test-runner/src/package.rs index 60daf34d70..8de1f32c3f 100644 --- a/test/test-runner/src/package.rs +++ b/test/test-runner/src/package.rs @@ -128,11 +128,7 @@ pub async fn install_package(package: Package) -> Result<()> { #[cfg(target_os = "linux")] async fn install_apt(path: &Path) -> Result<()> { - let mut cmd = Command::new("/usr/bin/apt"); - // We don't want to fail due to the global apt lock being - // held, which happens sporadically. Wait to acquire the lock - // instead. - cmd.args(["-o", "DPkg::Lock::Timeout=60"]); + let mut cmd = apt_command(); cmd.arg("install"); cmd.arg(path.as_os_str()); cmd.kill_on_drop(true); @@ -149,11 +145,7 @@ async fn install_apt(path: &Path) -> Result<()> { #[cfg(target_os = "linux")] async fn uninstall_apt(name: &str, env: HashMap<String, String>, purge: bool) -> Result<()> { let action; - let mut cmd = Command::new("/usr/bin/apt"); - // We don't want to fail due to the global apt lock being - // held, which happens sporadically. Wait to acquire the lock - // instead. - cmd.args(["-o", "DPkg::Lock::Timeout=60"]); + let mut cmd = apt_command(); if purge { action = "apt purge"; cmd.args(["purge", name]); @@ -174,6 +166,20 @@ async fn uninstall_apt(name: &str, env: HashMap<String, String>, purge: bool) -> } #[cfg(target_os = "linux")] +fn apt_command() -> Command { + let mut cmd = Command::new("/usr/bin/apt-get"); + // We don't want to fail due to the global apt lock being + // held, which happens sporadically. Wait to acquire the lock + // instead. + cmd.args(["-o", "DPkg::Lock::Timeout=60"]); + cmd.arg("-qy"); + + cmd.env("DEBIAN_FRONTEND", "noninteractive"); + + cmd +} + +#[cfg(target_os = "linux")] async fn install_rpm(path: &Path) -> Result<()> { use std::time::Duration; |
