Skip to content

Commit

Permalink
Remove debug_cause_timeout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbraun96 committed Apr 10, 2024
1 parent 6f7c840 commit f98214f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 37 deletions.
16 changes: 3 additions & 13 deletions citadel_sdk/src/prefabs/client/peer_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,25 +442,15 @@ mod tests {
}

#[rstest]
#[case(2, false, UdpMode::Enabled)]
#[case(3, true, UdpMode::Disabled)]
#[case(2, UdpMode::Enabled)]
#[case(3, UdpMode::Disabled)]
#[timeout(std::time::Duration::from_secs(90))]
#[tokio::test(flavor = "multi_thread")]
async fn peer_to_peer_connect(
#[case] peer_count: usize,
#[case] debug_force_nat_timeout: bool,
#[case] udp_mode: UdpMode,
) {
async fn peer_to_peer_connect(#[case] peer_count: usize, #[case] udp_mode: UdpMode) {
assert!(peer_count > 1);
citadel_logging::setup_log();
TestBarrier::setup(peer_count);

if debug_force_nat_timeout {
std::env::set_var("debug_cause_timeout", "ON");
} else {
std::env::remove_var("debug_cause_timeout");
}

let client_success = &AtomicUsize::new(0);
let (server, server_addr) = server_info();

Expand Down
20 changes: 3 additions & 17 deletions citadel_sdk/src/prefabs/client/single_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,24 +393,17 @@ mod tests {
}

#[rstest]
#[case(false, UdpMode::Enabled, None)]
#[case(false, UdpMode::Enabled, Some("test-password"))]
#[case(UdpMode::Enabled, None)]
#[case(UdpMode::Enabled, Some("test-password"))]
#[timeout(std::time::Duration::from_secs(90))]
#[tokio::test(flavor = "multi_thread")]
async fn test_single_connection_passwordless(
#[case] debug_force_nat_timeout: bool,
#[case] udp_mode: UdpMode,
#[case] server_password: Option<&'static str>,
) {
citadel_logging::setup_log();
TestBarrier::setup(2);

if debug_force_nat_timeout {
std::env::set_var("debug_cause_timeout", "ON");
} else {
std::env::remove_var("debug_cause_timeout");
}

let client_success = &AtomicBool::new(false);
let server_success = &AtomicBool::new(false);
let (server, server_addr) = server_info_reactive(
Expand Down Expand Up @@ -455,23 +448,16 @@ mod tests {
}

#[rstest]
#[case(false, UdpMode::Enabled, Some("test-password"))]
#[case(UdpMode::Enabled, Some("test-password"))]
#[timeout(std::time::Duration::from_secs(90))]
#[tokio::test(flavor = "multi_thread")]
async fn test_single_connection_passwordless_wrong_password(
#[case] debug_force_nat_timeout: bool,
#[case] udp_mode: UdpMode,
#[case] server_password: Option<&'static str>,
) {
citadel_logging::setup_log();
TestBarrier::setup(2);

if debug_force_nat_timeout {
std::env::set_var("debug_cause_timeout", "ON");
} else {
std::env::remove_var("debug_cause_timeout");
}

let (server, server_addr) = server_info_reactive(
|_conn, _remote| async move { panic!("Server should not have connected") },
|opts| {
Expand Down
8 changes: 1 addition & 7 deletions citadel_wire/src/udp_traversal/udp_hole_puncher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@ impl<'a> UdpHolePuncher<'a> {
) -> Self {
Self {
driver: Box::pin(async move {
// for debugging purposes
if std::env::var("debug_cause_timeout").unwrap_or_default() != "ON" {
tokio::time::timeout(timeout, driver(conn, encrypted_config_container)).await?
} else {
log::warn!(target: "citadel", "DEBUG_CAUSE_TIMEOUT enabled");
Err(anyhow::Error::msg("DEBUG_CAUSE_TIMEOUT invoked"))
}
tokio::time::timeout(timeout, driver(conn, encrypted_config_container)).await?
}),
}
}
Expand Down

0 comments on commit f98214f

Please sign in to comment.