From 423affef4fdf484338cbf33691a318718ab6bea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20L=C3=B6nnhager?= Date: Mon, 8 Apr 2024 19:42:55 +0200 Subject: [PATCH] Fix flakey test_lan and test_lockdown tests --- test/test-manager/src/tests/settings.rs | 38 ++++++++++++++----------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/test/test-manager/src/tests/settings.rs b/test/test-manager/src/tests/settings.rs index 2b488dea22d4..423236e1f5c8 100644 --- a/test/test-manager/src/tests/settings.rs +++ b/test/test-manager/src/tests/settings.rs @@ -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 // @@ -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 // @@ -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 // @@ -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 // @@ -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 // @@ -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 //