Skip to content

Commit

Permalink
Add unit test for daita_use_anywhere with singlehop
Browse files Browse the repository at this point in the history
  • Loading branch information
hulthe committed Aug 23, 2024
1 parent f365382 commit 29df1cc
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion mullvad-relay-selector/tests/relay_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,29 @@ fn test_daita() {
assert!(!supports_daita(&exit), "exit relay must not support DAITA");
}
wrong_relay => panic!(
"Relay selector should have picked a Wireguard relay, instead chose {wrong_relay:?}"
"Relay selector should have picked two Wireguard relays, instead chose {wrong_relay:?}"
),
}

// Should be able to connect to DAITA relay with use_anywhere
let query = RelayQueryBuilder::new()
.wireguard()
.daita()
.daita_use_anywhere(true)
.location(daita_supporting_relay.clone())
.build();
let relay = relay_selector
.get_relay_by_query(query)
.expect("Expected to find a relay with daita_use_anywhere");
match relay {
GetRelay::Wireguard {
inner: WireguardConfig::Singlehop { exit },
..
} => {
assert!(supports_daita(&exit), "entry relay must support DAITA");
}
wrong_relay => panic!(
"Relay selector should have picked a single Wireguard relay, instead chose {wrong_relay:?}"
),
}

Expand Down

0 comments on commit 29df1cc

Please sign in to comment.