mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
20 lines
629 B
Rust
20 lines
629 B
Rust
extern crate cgroups;
|
|
|
|
use cgroups::{Cgroup, CgroupError};
|
|
use cgroups::cpuset::CpuSetController;
|
|
|
|
#[test]
|
|
fn test_cpuset_memory_pressure_root_cg() {
|
|
let hier = cgroups::hierarchies::V1::new();
|
|
let cg = Cgroup::new(&hier, String::from("test_cpuset_memory_pressure_root_cg"));
|
|
{
|
|
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
|
|
|
// This is not a root control group, so it should fail via InvalidOperation.
|
|
let res = cpuset.set_enable_memory_pressure(true);
|
|
assert!(res.is_err());
|
|
assert_eq!(res.unwrap_err(), CgroupError::InvalidOperation);
|
|
}
|
|
cg.delete();
|
|
}
|