diff options
| author | Joakim Hulthe <joakim.hulthe@mullvad.net> | 2025-09-09 13:05:00 +0200 |
|---|---|---|
| committer | Joakim Hulthe <joakim.hulthe@mullvad.net> | 2025-09-15 11:07:17 +0200 |
| commit | ac6e10a42340128096017fee64902eb14972b3f1 (patch) | |
| tree | 73a2bae106a8dd6813ac401b3965a200fef59f3f /test | |
| parent | bab9ed40c689be1c2b3f082babb7e6bd0da662d2 (diff) | |
| download | mullvadvpn-ac6e10a42340128096017fee64902eb14972b3f1.tar.xz mullvadvpn-ac6e10a42340128096017fee64902eb14972b3f1.zip | |
Split test_wireguard_tunnel test into IPv4 and IPv6 variants
Diffstat (limited to 'test')
| -rw-r--r-- | test/Cargo.lock | 7 | ||||
| -rw-r--r-- | test/test-manager/Cargo.toml | 1 | ||||
| -rw-r--r-- | test/test-manager/src/tests/tunnel.rs | 17 |
3 files changed, 21 insertions, 4 deletions
diff --git a/test/Cargo.lock b/test/Cargo.lock index 8552fc8486..5db3b80650 100644 --- a/test/Cargo.lock +++ b/test/Cargo.lock @@ -749,6 +749,12 @@ dependencies = [ ] [[package]] +name = "duplicate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97af9b5f014e228b33e77d75ee0e6e87960124f0f4b16337b586a6bec91867b1" + +[[package]] name = "ecdsa" version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3769,6 +3775,7 @@ dependencies = [ "colored", "data-encoding-macro", "dirs", + "duplicate", "env_logger", "futures", "glob", diff --git a/test/test-manager/Cargo.toml b/test/test-manager/Cargo.toml index 0d976dd136..1583681b63 100644 --- a/test/test-manager/Cargo.toml +++ b/test/test-manager/Cargo.toml @@ -65,6 +65,7 @@ ssh2 = { version = "0.9.5", features = ["vendored-openssl"] } nix = { workspace = true } socket2 = { workspace = true } +duplicate = { version = "2.0.0", default-features = false } [target.'cfg(target_os = "macos")'.dependencies] tun = "0.5.1" diff --git a/test/test-manager/src/tests/tunnel.rs b/test/test-manager/src/tests/tunnel.rs index 5e7e1eb383..0cd902dff2 100644 --- a/test/test-manager/src/tests/tunnel.rs +++ b/test/test-manager/src/tests/tunnel.rs @@ -9,6 +9,7 @@ use crate::{ }; use anyhow::{Context, ensure}; +use duplicate::duplicate_item; use mullvad_management_interface::MullvadProxyClient; use mullvad_relay_selector::query::builder::RelayQueryBuilder; use mullvad_types::{ @@ -20,7 +21,7 @@ use mullvad_types::{ }; use std::net::SocketAddr; use talpid_types::net::{ - TransportProtocol, TunnelType, + IpVersion, TransportProtocol, TunnelType, proxy::{CustomProxy, Socks5Local, Socks5Remote}, }; use test_macro::test_function; @@ -82,21 +83,29 @@ pub async fn test_openvpn_tunnel( /// Set up a WireGuard tunnel. /// This test fails if a working tunnel cannot be set up. /// WARNING: This test will fail if host has something bound to port 53 such as a connected Mullvad +#[duplicate_item( + VX test_wireguard_tunnel_ipvx; + [ V4 ] [ test_wireguard_tunnel_ipv4 ]; + [ V6 ] [ test_wireguard_tunnel_ipv6 ]; +)] #[test_function] -pub async fn test_wireguard_tunnel( +pub async fn test_wireguard_tunnel_ipvx( _: TestContext, rpc: ServiceClient, mut mullvad_client: MullvadProxyClient, ) -> Result<(), Error> { // TODO: observe UDP traffic on the expected destination/port (only) - // TODO: IPv6 const PORTS: [(u16, bool); 3] = [(53, true), (51820, true), (1, false)]; + let ip_version = IpVersion::VX; for (port, should_succeed) in PORTS { log::info!("Connect to WireGuard endpoint on port {port}"); - let query = RelayQueryBuilder::wireguard().port(port).build(); + let query = RelayQueryBuilder::wireguard() + .port(port) + .ip_version(ip_version) + .build(); apply_settings_from_relay_query(&mut mullvad_client, query) .await |
