Skip to content

Commit

Permalink
Solve the immediate problem
Browse files Browse the repository at this point in the history
Manually clean up the messed up daemon state upon exit from
`test_establish_tunnel_without_api` using the ScopeGuard/defer pattern.
  • Loading branch information
MarkusPettersson98 committed Apr 9, 2024
1 parent 22d7b71 commit a03c362
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test-manager/src/tests/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit a03c362

Please sign in to comment.