From f98214f1ad5ccfd0c9e126cfd7ec599f0792abf3 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 10 Apr 2024 15:25:19 -0400 Subject: [PATCH] Remove debug_cause_timeout tests --- .../src/prefabs/client/peer_connection.rs | 16 +++------------ .../src/prefabs/client/single_connection.rs | 20 +++---------------- .../src/udp_traversal/udp_hole_puncher.rs | 8 +------- 3 files changed, 7 insertions(+), 37 deletions(-) diff --git a/citadel_sdk/src/prefabs/client/peer_connection.rs b/citadel_sdk/src/prefabs/client/peer_connection.rs index 83b4a5119..f55c05148 100644 --- a/citadel_sdk/src/prefabs/client/peer_connection.rs +++ b/citadel_sdk/src/prefabs/client/peer_connection.rs @@ -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(); diff --git a/citadel_sdk/src/prefabs/client/single_connection.rs b/citadel_sdk/src/prefabs/client/single_connection.rs index 3714b58b7..0c5b27074 100644 --- a/citadel_sdk/src/prefabs/client/single_connection.rs +++ b/citadel_sdk/src/prefabs/client/single_connection.rs @@ -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( @@ -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| { diff --git a/citadel_wire/src/udp_traversal/udp_hole_puncher.rs b/citadel_wire/src/udp_traversal/udp_hole_puncher.rs index 02eb59b67..980b95af5 100644 --- a/citadel_wire/src/udp_traversal/udp_hole_puncher.rs +++ b/citadel_wire/src/udp_traversal/udp_hole_puncher.rs @@ -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? }), } }