use cgroups_rs::fs::pid::PidController;
use cgroups_rs::fs::{Cgroup, MaxValue, PidResources, Resources};
#[test]
fn pid_resources() {
let h = cgroups_rs::fs::hierarchies::auto();
let cg = Cgroup::new(h, String::from("pid_resources")).unwrap();
{
let res = Resources {
pid: PidResources {
maximum_number_of_processes: Some(MaxValue::Value(512)),
},
..Default::default()
};
cg.apply(&res).unwrap();
let pidcontroller: &PidController = cg.controller_of().unwrap();
let pid_max = pidcontroller.get_pid_max();
assert!(pid_max.is_ok());
assert_eq!(pid_max.unwrap(), MaxValue::Value(512));
}
cg.delete().unwrap();
}