From 20dd36ba92e080af3a0ff14e4973fdca43b71bed Mon Sep 17 00:00:00 2001 From: Markus Pettersson Date: Fri, 20 Oct 2023 15:39:07 +0200 Subject: [PATCH] Relax relay constraints in `test_quantum_resistant_multihop_udp2tcp_tunnel` Loosen up relay constraints in `test_quantum_resistant_multihop_udp2tcp_tunnel`, which makes the test more resilient to changes in the testing environment. --- .../types/conversions/relay_constraints.rs | 6 +++ test/test-manager/src/tests/tunnel.rs | 49 ++++++++++--------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/mullvad-management-interface/src/types/conversions/relay_constraints.rs b/mullvad-management-interface/src/types/conversions/relay_constraints.rs index 4fb96d4e0e23..b33bf3c1657f 100644 --- a/mullvad-management-interface/src/types/conversions/relay_constraints.rs +++ b/mullvad-management-interface/src/types/conversions/relay_constraints.rs @@ -331,6 +331,12 @@ impl From<&mullvad_types::relay_constraints::ObfuscationSettings> for proto::Obf } } +impl From for proto::ObfuscationSettings { + fn from(settings: mullvad_types::relay_constraints::ObfuscationSettings) -> Self { + proto::ObfuscationSettings::from(&settings) + } +} + impl From<&mullvad_types::relay_constraints::Udp2TcpObfuscationSettings> for proto::Udp2TcpObfuscationSettings { diff --git a/test/test-manager/src/tests/tunnel.rs b/test/test-manager/src/tests/tunnel.rs index c74518d45b3b..be0a24dd14dc 100644 --- a/test/test-manager/src/tests/tunnel.rs +++ b/test/test-manager/src/tests/tunnel.rs @@ -581,38 +581,39 @@ pub async fn test_quantum_resistant_multihop_udp2tcp_tunnel( rpc: ServiceClient, mut mullvad_client: ManagementServiceClient, ) -> Result<(), Error> { + use mullvad_types::{ + relay_constraints::{ObfuscationSettings, SelectedObfuscation, Udp2TcpObfuscationSettings}, + wireguard::QuantumResistantState, + }; mullvad_client - .set_quantum_resistant_tunnel(types::QuantumResistantState { - state: i32::from(types::quantum_resistant_state::State::On), - }) + .set_quantum_resistant_tunnel(types::QuantumResistantState::from( + QuantumResistantState::On, + )) .await .expect("Failed to enable PQ tunnels"); mullvad_client - .set_obfuscation_settings(types::ObfuscationSettings { - selected_obfuscation: i32::from( - types::obfuscation_settings::SelectedObfuscation::Udp2tcp, - ), - udp2tcp: Some(types::Udp2TcpObfuscationSettings { port: None }), - }) + .set_obfuscation_settings(types::ObfuscationSettings::from(ObfuscationSettings { + selected_obfuscation: SelectedObfuscation::Udp2Tcp, + udp2tcp: Udp2TcpObfuscationSettings { + port: Constraint::Any, + }, + })) .await .expect("Failed to enable obfuscation"); - let relay_settings = RelaySettingsUpdate::Normal(RelayConstraintsUpdate { - location: Some(Constraint::Only(LocationConstraint::Location( - GeographicLocationConstraint::Country("se".to_string()), - ))), - wireguard_constraints: Some(WireguardConstraints { - use_multihop: true, - entry_location: Constraint::Only(LocationConstraint::Location( - GeographicLocationConstraint::Country("se".to_string()), - )), - ..Default::default() - }), - ..Default::default() - }); - - update_relay_settings(&mut mullvad_client, relay_settings) + mullvad_client + .update_relay_settings(types::RelaySettingsUpdate::from( + RelaySettingsUpdate::Normal(RelayConstraintsUpdate { + wireguard_constraints: WireguardConstraints { + use_multihop: true, + ..Default::default() + } + .into(), + tunnel_protocol: Constraint::Only(TunnelType::Wireguard).into(), + ..Default::default() + }), + )) .await .expect("Failed to update relay settings");