summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-11-14 17:43:57 +0100
committerSebastian Holmin <sebastian.holmin@mullvad.net>2024-11-14 17:43:57 +0100
commit7db530da889b2bddd011e25b6cb12407f535a810 (patch)
tree92199aed300e887c17dd23ab2f1b820fbf170655 /test
parentd4d0d4894b970ea537f01c87a7a1b777b4467d4f (diff)
parent90ee7b5fb774c36dbc71b7b9a4f3e67b800fdf23 (diff)
downloadmullvadvpn-7db530da889b2bddd011e25b6cb12407f535a810.tar.xz
mullvadvpn-7db530da889b2bddd011e25b6cb12407f535a810.zip
Merge branch 'test_ui_tunnel_settings-fails-a-lot-des-1351'
Diffstat (limited to 'test')
-rw-r--r--test/test-manager/src/tests/helpers.rs20
-rw-r--r--test/test-manager/src/tests/ui.rs10
2 files changed, 26 insertions, 4 deletions
diff --git a/test/test-manager/src/tests/helpers.rs b/test/test-manager/src/tests/helpers.rs
index 10842985ef..0c3f16ccb3 100644
--- a/test/test-manager/src/tests/helpers.rs
+++ b/test/test-manager/src/tests/helpers.rs
@@ -723,9 +723,10 @@ pub async fn constrain_to_relay(
}
}
+ let settings = mullvad_client.get_settings().await?;
// Construct a relay selector with up-to-date information from the runnin daemon's relay list
let relay_list = mullvad_client.get_relay_locations().await?;
- let relay_selector = RelaySelector::from_list(SelectorConfig::default(), relay_list);
+ let relay_selector = get_daemon_relay_selector(&settings, relay_list);
// Select an(y) appropriate relay for the given query and constrain the daemon to only connect
// to that specific relay (when connecting).
let relay = relay_selector.get_relay_by_query(query.clone())?;
@@ -735,6 +736,17 @@ pub async fn constrain_to_relay(
Ok(exit)
}
+/// Get a mirror of the relay selector used by the daemon.
+///
+/// This can be used to query the relay selector without triggering a tunnel state change in the
+/// daemon.
+fn get_daemon_relay_selector(
+ settings: &mullvad_types::settings::Settings,
+ relay_list: mullvad_types::relay_list::RelayList,
+) -> RelaySelector {
+ RelaySelector::from_list(SelectorConfig::from_settings(settings), relay_list)
+}
+
/// Convenience function for constructing a constraint from a given [`Relay`].
///
/// # Panics
@@ -1190,8 +1202,9 @@ pub mod custom_lists {
// Expose all custom list variants as a shorthand.
pub use List::*;
- /// Mapping between [List] to daemon custom lists. Since custom list ids are assigned by the daemon at the creation
- /// of the custom list settings object, we can't map a custom list name to a specific list before runtime.
+ /// Mapping between [List] to daemon custom lists. Since custom list ids are assigned by the
+ /// daemon at the creation of the custom list settings object, we can't map a custom list
+ /// name to a specific list before runtime.
static IDS: LazyLock<Mutex<HashMap<List, Id>>> = LazyLock::new(|| Mutex::new(HashMap::new()));
/// Pre-defined (well-typed) custom lists which may be useuful in different test scenarios.
@@ -1281,6 +1294,7 @@ pub mod custom_lists {
.create_custom_list(custom_list.name())
.await?;
let mut daemon_dito = find_custom_list(mullvad_client, &custom_list.name()).await?;
+ assert_eq!(id, daemon_dito.id);
for locations in custom_list.locations() {
daemon_dito.locations.insert(locations);
}
diff --git a/test/test-manager/src/tests/ui.rs b/test/test-manager/src/tests/ui.rs
index 53c769a7cc..994557748b 100644
--- a/test/test-manager/src/tests/ui.rs
+++ b/test/test-manager/src/tests/ui.rs
@@ -91,11 +91,19 @@ pub async fn test_ui_tunnel_settings(
rpc: ServiceClient,
mut mullvad_client: MullvadProxyClient,
) -> anyhow::Result<()> {
+ // NOTE: This test connects multiple times using various settings, some of which may cauase a
+ // significant increase in connection time, e.g. multihop and OpenVPN. For this reason, it is
+ // preferable to only target low latency servers.
+ use helpers::custom_lists::LowLatency;
+
// tunnel-state.spec precondition: a single WireGuard relay should be selected
log::info!("Select WireGuard relay");
let entry = helpers::constrain_to_relay(
&mut mullvad_client,
- RelayQueryBuilder::new().wireguard().build(),
+ RelayQueryBuilder::new()
+ .wireguard()
+ .location(LowLatency)
+ .build(),
)
.await?;