use super::*;
#[test]
fn test_is_benign_connectivity_notice() {
for code in BENIGN_CONNECTIVITY_CODES {
assert!(is_benign_connectivity_notice(code), "code {code} should be benign");
}
for code in [
2100, 2103, 2105, 2157, 2169, 200, ] {
assert!(!is_benign_connectivity_notice(code), "code {code} should not be benign");
}
}
#[test]
fn test_log_unrouted_notice_traverses_all_severities() {
log_unrouted_notice(&Notice::synthesized(BENIGN_CONNECTIVITY_CODES[0], "farm OK".into()));
log_unrouted_notice(&Notice::synthesized(2103, "farm broken".into()));
log_unrouted_notice(&Notice::synthesized(200, "no security definition".into()));
}
#[test]
fn test_fibonacci_backoff() {
let mut backoff = FibonacciBackoff::new(10);
assert_eq!(backoff.next_delay(), Duration::from_secs(1));
assert_eq!(backoff.next_delay(), Duration::from_secs(2));
assert_eq!(backoff.next_delay(), Duration::from_secs(3));
assert_eq!(backoff.next_delay(), Duration::from_secs(5));
assert_eq!(backoff.next_delay(), Duration::from_secs(8));
assert_eq!(backoff.next_delay(), Duration::from_secs(10)); assert_eq!(backoff.next_delay(), Duration::from_secs(10)); }