Skip to content

Commit

Permalink
Fix flakey test_lan and test_lockdown tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Apr 8, 2024
1 parent 6868d3c commit 423affe
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions test/test-manager/src/tests/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ pub async fn test_lan(
) -> Result<(), Error> {
let lan_destination = SocketAddr::new(IpAddr::V4(DUMMY_LAN_INTERFACE_IP), 1234);

//
// Connect
//

connect_and_wait(&mut mullvad_client).await?;

//
// Disable LAN sharing
//
Expand All @@ -40,6 +34,12 @@ pub async fn test_lan(
.await
.expect("failed to disable LAN sharing");

//
// Connect
//

connect_and_wait(&mut mullvad_client).await?;

//
// Ensure LAN is not reachable
//
Expand All @@ -65,6 +65,9 @@ pub async fn test_lan(
.await
.expect("failed to enable LAN sharing");

// Firewall updates are a bit racey, so wait for a while
tokio::time::sleep(std::time::Duration::from_secs(1)).await;

//
// Ensure LAN is reachable
//
Expand Down Expand Up @@ -106,16 +109,6 @@ pub async fn test_lockdown(
let lan_destination: SocketAddr = SocketAddr::new(IpAddr::V4(DUMMY_LAN_INTERFACE_IP), 1337);
let inet_destination: SocketAddr = "1.1.1.1:1337".parse().unwrap();

log::info!("Verify tunnel state: disconnected");
assert_tunnel_state!(&mut mullvad_client, TunnelState::Disconnected { .. });

// Enable lockdown mode
//
mullvad_client
.set_block_when_disconnected(true)
.await
.expect("failed to enable lockdown mode");

//
// Disable LAN sharing
//
Expand All @@ -127,6 +120,16 @@ pub async fn test_lockdown(
.await
.expect("failed to disable LAN sharing");

// Enable lockdown mode
//
mullvad_client
.set_block_when_disconnected(true)
.await
.expect("failed to enable lockdown mode");

// Firewall updates are a bit racey, so wait for a while
tokio::time::sleep(std::time::Duration::from_secs(1)).await;

//
// Ensure all destinations are unreachable
//
Expand Down Expand Up @@ -158,6 +161,9 @@ pub async fn test_lockdown(
.await
.expect("failed to enable LAN sharing");

// Firewall updates are a bit racey, so wait for a while
tokio::time::sleep(std::time::Duration::from_secs(1)).await;

//
// Ensure private IPs are reachable, but not others
//
Expand Down

0 comments on commit 423affe

Please sign in to comment.