121 lines
3.9 KiB
Rust
121 lines
3.9 KiB
Rust
// Reliability contracts for Jenkins cadence and lab isolation.
|
|
//
|
|
// Scope: inspect Jenkins and CI entrypoint scripts.
|
|
// Targets: `Jenkinsfile`, `scripts/ci/daily_master_gate.sh`,
|
|
// `scripts/ci/baremetal_lab_gate.sh`.
|
|
// Why: Lesavka needs daily primary-branch signal without letting hardware or
|
|
// virtual HID tests disturb a shared desktop. The slower lab path must stay
|
|
// explicit so quality ratchets can grow safely.
|
|
|
|
const JENKINSFILE: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/Jenkinsfile"));
|
|
const DAILY_GATE: &str = include_str!(concat!(
|
|
env!("CARGO_MANIFEST_DIR"),
|
|
"/scripts/ci/daily_master_gate.sh"
|
|
));
|
|
const LAB_GATE: &str = include_str!(concat!(
|
|
env!("CARGO_MANIFEST_DIR"),
|
|
"/scripts/ci/baremetal_lab_gate.sh"
|
|
));
|
|
const OPERATIONAL_ENV: &str = include_str!(concat!(
|
|
env!("CARGO_MANIFEST_DIR"),
|
|
"/docs/operational-env.md"
|
|
));
|
|
|
|
#[test]
|
|
fn jenkins_exposes_safe_daily_and_lab_profiles() {
|
|
for expected in [
|
|
"LESAVKA_CI_PROFILE",
|
|
"choices: ['safe', 'daily', 'lab']",
|
|
"Daily Master Gate",
|
|
"scripts/ci/daily_master_gate.sh",
|
|
"RUN_DISRUPTIVE_INPUT_TESTS",
|
|
"Input Transport (Isolated Opt-In)",
|
|
"LESAVKA_ALLOW_DISRUPTIVE_INPUT_TESTS=1",
|
|
"RUN_LAB_HARDWARE_GATES",
|
|
"Bare-Metal Lab Gates (Opt-In)",
|
|
"scripts/ci/baremetal_lab_gate.sh",
|
|
] {
|
|
assert!(
|
|
JENKINSFILE.contains(expected),
|
|
"Jenkinsfile should expose cadence/safety control: {expected}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn jenkins_archives_profile_and_performance_artifacts() {
|
|
for expected in [
|
|
"target/daily-master-gate/**",
|
|
"target/performance-gate/**",
|
|
"target/input-transport-gate/**",
|
|
"target/baremetal-lab-gate/**",
|
|
"target/video-downstream-gate/**",
|
|
] {
|
|
assert!(
|
|
JENKINSFILE.contains(expected),
|
|
"Jenkins should retain ratchet evidence: {expected}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn daily_gate_is_primary_branch_safe_and_runs_platform_gate() {
|
|
for expected in [
|
|
"master|main|origin/master|origin/main|*/master|*/main",
|
|
"LESAVKA_DAILY_ALLOW_NON_PRIMARY",
|
|
"LESAVKA_CI_PROFILE=daily scripts/ci/platform_quality_gate.sh",
|
|
"target/daily-master-gate",
|
|
"lesavka_ci_profile_last_run_success",
|
|
"LESAVKA_DAILY_GATE_PUSHGATEWAY_JOB",
|
|
] {
|
|
assert!(
|
|
DAILY_GATE.contains(expected),
|
|
"daily gate should guard primary-branch cadence: {expected}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn lab_gate_requires_explicit_hardware_and_probe_opt_ins() {
|
|
for expected in [
|
|
"LESAVKA_ALLOW_LAB_HARDWARE_TESTS",
|
|
"Skipping bare-metal lab gates",
|
|
"LESAVKA_RUN_VIDEO_DOWNSTREAM_GATE",
|
|
"LESAVKA_ALLOW_DISRUPTIVE_INPUT_TESTS",
|
|
"LESAVKA_RUN_SERVER_RCT_MATRIX",
|
|
"LESAVKA_SERVER_RCT_MATRIX_CMD",
|
|
"run_server_to_rc_mode_matrix.sh",
|
|
"LESAVKA_RUN_CLIENT_RCT_PROBE",
|
|
"LESAVKA_CLIENT_RCT_PROBE_CMD",
|
|
"run_client_to_rct_transport_probe.sh",
|
|
"target/baremetal-lab-gate",
|
|
"lesavka_lab_gate_step_result",
|
|
] {
|
|
assert!(
|
|
LAB_GATE.contains(expected),
|
|
"lab gate should make hardware/disruptive work explicit: {expected}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn new_ci_cadence_knobs_are_documented() {
|
|
for expected in [
|
|
"LESAVKA_ALLOW_LAB_HARDWARE_TESTS",
|
|
"LESAVKA_CI_PROFILE",
|
|
"LESAVKA_DAILY_ALLOW_NON_PRIMARY",
|
|
"LESAVKA_DAILY_GATE_PUSHGATEWAY_JOB",
|
|
"LESAVKA_LAB_GATE_PUSHGATEWAY_JOB",
|
|
"LESAVKA_CLIENT_RCT_PROBE_CMD",
|
|
"LESAVKA_RUN_CLIENT_RCT_PROBE",
|
|
"LESAVKA_RUN_SERVER_RCT_MATRIX",
|
|
"LESAVKA_RUN_VIDEO_DOWNSTREAM_GATE",
|
|
"LESAVKA_SERVER_RCT_MATRIX_CMD",
|
|
] {
|
|
assert!(
|
|
OPERATIONAL_ENV.contains(expected),
|
|
"operational env inventory should document {expected}"
|
|
);
|
|
}
|
|
}
|