lesavka/testing/tests/performance_gate_script_contract.rs

43 lines
1.6 KiB
Rust
Raw Normal View History

2026-04-30 08:16:57 -03:00
//! Contract tests for the deterministic performance gate.
//!
//! Scope: inspect CI gate scripts for latency-sensitive Lesavka checks.
//! Targets: `scripts/ci/performance_gate.sh`, `scripts/ci/platform_quality_gate.sh`.
//! Why: A/V sync and remote-control tightness are product behavior, so the main
//! quality gate must fail before release when their contracts regress.
const PERFORMANCE_GATE: &str = include_str!("../../scripts/ci/performance_gate.sh");
const PLATFORM_GATE: &str = include_str!("../../scripts/ci/platform_quality_gate.sh");
#[test]
fn performance_gate_tracks_av_and_interaction_latency_contracts() {
for expected in [
"client_uplink_performance_contract",
"client_uplink_freshness_contract",
"client_log_noise_contract",
"video_downstream_feed_contract",
"client_app_include_contract",
"platform_quality_gate_checks_total",
"check=\"performance\"",
"lesavka-performance-gate",
] {
assert!(
PERFORMANCE_GATE.contains(expected),
"performance gate should include {expected}"
);
}
}
#[test]
fn platform_gate_runs_performance_before_media_reliability() {
let performance = PLATFORM_GATE
.find("scripts/ci/performance_gate.sh")
.expect("platform gate should run performance gate");
let media = PLATFORM_GATE
.find("scripts/ci/media_reliability_gate.sh")
.expect("platform gate should run media reliability gate");
assert!(
performance < media,
"performance regressions should fail before broader media packaging checks"
);
}