57 lines
2.3 KiB
Rust
57 lines
2.3 KiB
Rust
//! Contracts for keeping steady-state live-media recovery logs actionable.
|
|
//!
|
|
//! Scope: inspect client live-media logging and recovery source text.
|
|
//! Targets: `client/src/app/uplink_media/drop_logging.rs`,
|
|
//! `client/src/app/downlink_media.rs`.
|
|
//! Why: freshness-first media handling should not turn normal queue churn into
|
|
//! high-volume warnings that hide real failures or steal runtime budget.
|
|
|
|
const UPLINK_DROP_LOGGING_SRC: &str =
|
|
include_str!("../../client/src/app/uplink_media/drop_logging.rs");
|
|
const DOWNLINK_MEDIA_SRC: &str = include_str!("../../client/src/app/downlink_media.rs");
|
|
const AUDIO_RECOVERY_SRC: &str = include_str!("../../client/src/app/audio_recovery_config.rs");
|
|
|
|
#[test]
|
|
fn upstream_queue_drops_are_rate_limited_instead_of_warn_spammed() {
|
|
assert!(
|
|
UPLINK_DROP_LOGGING_SRC.contains("UplinkDropLogLimiter"),
|
|
"uplink queue drops should flow through a rate-limited logger"
|
|
);
|
|
assert!(
|
|
UPLINK_DROP_LOGGING_SRC.contains("UPLINK_DROP_WARN_INTERVAL"),
|
|
"uplink drop warnings should have an explicit aggregation interval"
|
|
);
|
|
for noisy in [
|
|
"upstream camera queue dropped stale packets",
|
|
"upstream microphone queue dropped stale packets",
|
|
"upstream camera queue dropped the oldest frame because it was full",
|
|
"upstream microphone queue dropped the oldest packet because it was full",
|
|
] {
|
|
assert!(
|
|
!UPLINK_DROP_LOGGING_SRC.contains(noisy),
|
|
"normal freshness-first drop churn should not WARN every packet: {noisy}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn repeated_remote_audio_failures_are_rate_limited() {
|
|
assert!(
|
|
AUDIO_RECOVERY_SRC.contains("AudioFailureLogLimiter"),
|
|
"remote audio failures should flow through a rate-limited logger"
|
|
);
|
|
assert!(
|
|
AUDIO_RECOVERY_SRC.contains("AUDIO_FAILURE_WARN_INTERVAL"),
|
|
"audio failure warnings should have an explicit aggregation interval"
|
|
);
|
|
assert!(
|
|
!DOWNLINK_MEDIA_SRC.contains("audio stream recv error"),
|
|
"repeated recv errors should use the audio failure limiter instead of direct WARN spam"
|
|
);
|
|
assert!(
|
|
DOWNLINK_MEDIA_SRC.contains("tracing::debug!(")
|
|
&& DOWNLINK_MEDIA_SRC.contains("waiting before USB recovery"),
|
|
"below-threshold auto-recovery bookkeeping should be DEBUG, not WARN"
|
|
);
|
|
}
|