#![cfg(feature = "worker")]
use std::process::Command;
fn docker_available() -> bool {
Command::new("docker")
.arg("version")
.output()
.is_ok_and(|o| o.status.success())
}
#[test]
#[ignore = "operational: needs docker + builds an image; runs in the dedicated CI job"]
fn operational_cpu_pool_parks_idle_with_control() {
if !docker_available() {
eprintln!("SKIP: docker unavailable -- operational CPU test not run");
return;
}
let script = concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/operational-cpu-test.sh"
);
let status = Command::new("bash")
.arg(script)
.arg("0.5") .arg("6000") .status()
.expect("failed to spawn operational-cpu-test.sh");
if status.code() == Some(2) {
eprintln!("SKIP: harness reported docker unavailable");
return;
}
assert!(
status.success(),
"operational CPU test failed (see script output above): the pool did \
not park idle relative to the busy-spin control, or the control was \
not cgroup-throttled"
);
}