From fa46d279a79dbcd39131f162ae82a37420aec29e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 10 Feb 2026 14:00:56 -0600 Subject: [PATCH] Use short SNMP timeouts in tests to avoid 90s waits Tests against unreachable hosts (192.0.2.1) were waiting 10s * 3 attempts per request. With cfg(test) overrides (1s timeout, 0 retries), the full test suite runs in ~3s instead of ~90s. --- src/snmp/client.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/snmp/client.rs b/src/snmp/client.rs index de46767..f8959b0 100644 --- a/src/snmp/client.rs +++ b/src/snmp/client.rs @@ -6,9 +6,17 @@ use zeroize::{Zeroize, Zeroizing}; type SecretString = Zeroizing; +#[cfg(not(test))] const SNMP_TIMEOUT_SECS: i64 = 10; +#[cfg(not(test))] const SNMP_RETRIES: i32 = 2; +// Use short timeouts in tests to avoid 90+ second waits on unreachable hosts +#[cfg(test)] +const SNMP_TIMEOUT_SECS: i64 = 1; +#[cfg(test)] +const SNMP_RETRIES: i32 = 0; + // C structs and functions #[repr(C)] #[derive(Clone)]