summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/test-manager/src/tests/helpers.rs16
-rw-r--r--test/test-manager/src/tests/tunnel.rs17
2 files changed, 18 insertions, 15 deletions
diff --git a/test/test-manager/src/tests/helpers.rs b/test/test-manager/src/tests/helpers.rs
index f73e6f6e79..e5f8c6034e 100644
--- a/test/test-manager/src/tests/helpers.rs
+++ b/test/test-manager/src/tests/helpers.rs
@@ -33,6 +33,22 @@ pub fn get_package_desc(name: &str) -> Result<Package, Error> {
})
}
+/// Reboot the guest virtual machine.
+///
+/// # macOS
+/// The tunnel must be reconfigured after the virtual machine is up,
+/// or macOS refuses to assign an IP. The reasons for this are poorly understood.
+pub async fn reboot(rpc: &mut ServiceClient) -> Result<(), Error> {
+ rpc.reboot().await?;
+
+ #[cfg(target_os = "macos")]
+ crate::vm::network::macos::configure_tunnel()
+ .await
+ .map_err(|error| Error::Other(format!("Failed to recreate custom wg tun: {error}")))?;
+
+ Ok(())
+}
+
#[derive(Debug, Default)]
pub struct ProbeResult {
tcp: usize,
diff --git a/test/test-manager/src/tests/tunnel.rs b/test/test-manager/src/tests/tunnel.rs
index 9edc2414a8..20fc1e076b 100644
--- a/test/test-manager/src/tests/tunnel.rs
+++ b/test/test-manager/src/tests/tunnel.rs
@@ -397,7 +397,7 @@ pub async fn test_wireguard_autoconnect(
.await
.expect("failed to enable auto-connect");
- reboot(&mut rpc).await?;
+ helpers::reboot(&mut rpc).await?;
rpc.mullvad_daemon_wait_for_state(|state| state == ServiceStatus::Running)
.await?;
@@ -439,7 +439,7 @@ pub async fn test_openvpn_autoconnect(
.await
.expect("failed to enable auto-connect");
- reboot(&mut rpc).await?;
+ helpers::reboot(&mut rpc).await?;
rpc.mullvad_daemon_wait_for_state(|state| state == ServiceStatus::Running)
.await?;
@@ -453,19 +453,6 @@ pub async fn test_openvpn_autoconnect(
Ok(())
}
-async fn reboot(rpc: &mut ServiceClient) -> Result<(), Error> {
- rpc.reboot().await?;
-
- // The tunnel must be reconfigured after the virtual machine is up,
- // or macOS refuses to assign an IP. The reasons for this are poorly understood.
- #[cfg(target_os = "macos")]
- crate::vm::network::macos::configure_tunnel()
- .await
- .map_err(|error| Error::Other(format!("Failed to recreate custom wg tun: {error}")))?;
-
- Ok(())
-}
-
/// Test whether quantum-resistant tunnels can be set up.
///
/// # Limitations