@@ -7,7 +7,7 @@ use test_rpc::ServiceClient;
7
7
8
8
use super :: {
9
9
helpers:: { self , ConnChecker } ,
10
- TestContext ,
10
+ ui , TestContext ,
11
11
} ;
12
12
13
13
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(
23
23
mut mullvad_client : MullvadProxyClient ,
24
24
) -> anyhow:: Result < ( ) > {
25
25
// 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 ( ( ) ) ;
33
28
}
34
29
35
30
let mut checker = ConnChecker :: new ( rpc. clone ( ) , mullvad_client. clone ( ) , LEAK_DESTINATION ) ;
@@ -86,3 +81,29 @@ pub async fn test_split_tunnel(
86
81
87
82
Ok ( ( ) )
88
83
}
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