Skip to content

Commit fe9fe0f

Browse files
committed
Run UI tests for macOS split tunneling
1 parent febf268 commit fe9fe0f

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

test/test-manager/src/tests/split_tunnel.rs

+29-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use test_rpc::ServiceClient;
77

88
use super::{
99
helpers::{self, ConnChecker},
10-
TestContext,
10+
ui, TestContext,
1111
};
1212

1313
const LEAK_DESTINATION: SocketAddr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(1, 1, 1, 1)), 1337);
@@ -23,13 +23,8 @@ pub async fn test_split_tunnel(
2323
mut mullvad_client: MullvadProxyClient,
2424
) -> anyhow::Result<()> {
2525
// Skip test on macOS 12, since the feature is unsupported
26-
match rpc.get_os_version().await.context("Detect OS version")? {
27-
OsVersion::Macos(version) if version.major <= 12 => {
28-
// TODO: Skip test cleanly, e.g. by returning a result `Pass | Skip`
29-
log::info!("Skipping test on macOS 12");
30-
return Ok(());
31-
}
32-
_ => (),
26+
if is_macos_12_or_lower(&rpc).await? {
27+
return Ok(());
3328
}
3429

3530
let mut checker = ConnChecker::new(rpc.clone(), mullvad_client.clone(), LEAK_DESTINATION);
@@ -86,3 +81,29 @@ pub async fn test_split_tunnel(
8681

8782
Ok(())
8883
}
84+
85+
/// Test that split tunneling works by asserting the following:
86+
/// - Splitting a process shouldn't do anything if tunnel is not connected.
87+
/// - A split process should never push traffic through the tunnel.
88+
/// - Splitting/unsplitting should work regardless if process is running.
89+
#[test_function(target_os = "macos")]
90+
pub async fn test_split_tunnel_ui(_ctx: TestContext, rpc: ServiceClient) -> anyhow::Result<()> {
91+
// Skip test on macOS 12, since the feature is unsupported
92+
if is_macos_12_or_lower(&rpc).await? {
93+
return Ok(());
94+
}
95+
96+
let ui_result = ui::run_test(&rpc, &["macos-split-tunneling.spec"])
97+
.await
98+
.unwrap();
99+
assert!(ui_result.success());
100+
101+
Ok(())
102+
}
103+
104+
async fn is_macos_12_or_lower(rpc: &ServiceClient) -> anyhow::Result<bool> {
105+
match rpc.get_os_version().await.context("Detect OS version")? {
106+
OsVersion::Macos(version) if version.major <= 12 => Ok(true),
107+
_ => Ok(false),
108+
}
109+
}

0 commit comments

Comments
 (0)