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.
This commit is contained in:
Graham McIntire 2026-02-10 14:00:56 -06:00
parent d91effd3eb
commit fa46d279a7
No known key found for this signature in database

View file

@ -6,9 +6,17 @@ use zeroize::{Zeroize, Zeroizing};
type SecretString = Zeroizing<String>;
#[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)]