#![cfg(feature = "memory")]
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_memory_cap_bounds_under_cgroup_with_control() {
if !docker_available() {
eprintln!("SKIP: docker unavailable -- operational memory test not run");
return;
}
let script = concat!(
env!("CARGO_MANIFEST_DIR"),
"/scripts/operational-mem-test.sh"
);
let status = Command::new("bash")
.arg(script)
.arg("512m") .arg("15") .status()
.expect("failed to spawn operational-mem-test.sh");
if status.code() == Some(2) {
eprintln!("SKIP: harness reported docker unavailable");
return;
}
assert!(
status.success(),
"operational memory test failed (see script output above): \
the cap did not bound memory under the cgroup limit, or the cap-off \
control did not OOM"
);
}