diff --git a/test/test-manager/src/tests/tunnel.rs b/test/test-manager/src/tests/tunnel.rs index 8c6482d48365..bcabf26ee07c 100644 --- a/test/test-manager/src/tests/tunnel.rs +++ b/test/test-manager/src/tests/tunnel.rs @@ -780,6 +780,17 @@ pub async fn test_establish_tunnel_without_api( rpc.stop_mullvad_daemon().await?; // 3 let borked_env = [("MULLVAD_API_ADDR", "1.3.3.7:421")]; + // 3.5 - Create a cleanup routine which resets the daemon's environment when the test is done. + let runtime_handle = tokio::runtime::Handle::try_current()?; + let mullvad_client_ = mullvad_client.clone(); + scopeguard::defer! { + let _ = runtime_handle.block_on(helpers::restart_daemon_with( + &rpc, + &ctx, + mullvad_client_, + helpers::get_app_env(), + )); + }; // 4 log::debug!("Restarting the daemon with the following overrides: {borked_env:?}"); let mut mullvad_client =