summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-08-05 12:03:49 +0200
committerMarkus Pettersson <markus.pettersson@mullvad.net>2024-08-09 09:43:58 +0200
commitf29fe95ff339ab4e599ab39e3fa182a257c331ad (patch)
treef041576e6c89fef23b0a8266f32241eebeb93812
parent8b758874f9827d986e1273a5633f2cb917701c00 (diff)
downloadmullvadvpn-f29fe95ff339ab4e599ab39e3fa182a257c331ad.tar.xz
mullvadvpn-f29fe95ff339ab4e599ab39e3fa182a257c331ad.zip
Capture errors in `systemclt` cmd
-rw-r--r--test/test-runner/src/sys.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/test/test-runner/src/sys.rs b/test/test-runner/src/sys.rs
index a53396d08f..e1060124d7 100644
--- a/test/test-runner/src/sys.rs
+++ b/test/test-runner/src/sys.rs
@@ -434,7 +434,7 @@ impl EnvVar {
#[cfg(target_os = "linux")]
pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(), test_rpc::Error> {
- use std::fmt::Write;
+ use std::{fmt::Write, ops::Not};
let mut override_content = String::new();
override_content.push_str("[Service]\n");
@@ -459,17 +459,31 @@ pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(),
.await
.map_err(|e| test_rpc::Error::Service(e.to_string()))?;
- tokio::process::Command::new("systemctl")
+ if tokio::process::Command::new("systemctl")
.args(["daemon-reload"])
.status()
.await
- .map_err(|e| test_rpc::Error::Service(e.to_string()))?;
+ .map_err(|e| test_rpc::Error::Io(e.to_string()))?
+ .success()
+ .not()
+ {
+ return Err(test_rpc::Error::Service(
+ "Daemon service could not be reloaded".to_owned(),
+ ));
+ };
- tokio::process::Command::new("systemctl")
+ if tokio::process::Command::new("systemctl")
.args(["restart", "mullvad-daemon"])
.status()
.await
- .map_err(|e| test_rpc::Error::Service(e.to_string()))?;
+ .map_err(|e| test_rpc::Error::Io(e.to_string()))?
+ .success()
+ .not()
+ {
+ return Err(test_rpc::Error::Service(
+ "Daemon service could not be restarted".to_owned(),
+ ));
+ };
wait_for_service_state(ServiceState::Running).await?;
Ok(())