mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
tests: move tests to tests/ directory and give the user cgroup perms
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//! Integration test about setting resources using `apply()`
|
||||
extern crate cgroups;
|
||||
|
||||
use cgroups::{Cgroup, Resources, PidResources};
|
||||
use cgroups::pid::{PidController, PidMax};
|
||||
|
||||
#[test]
|
||||
fn pid_resources() {
|
||||
let hier = cgroups::hierarchies::V1::new();
|
||||
let cg = Cgroup::new(&hier, String::from("pid_resources"));
|
||||
{
|
||||
let res = Resources {
|
||||
pid: PidResources {
|
||||
update_values: true,
|
||||
maximum_number_of_processes: PidMax::Value(512),
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
cg.apply(&res);
|
||||
|
||||
/* verify */
|
||||
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
||||
assert_eq!(pidcontroller.get_pid_max(), Some(PidMax::Value(512)));
|
||||
}
|
||||
cg.delete();
|
||||
}
|
||||
Reference in New Issue
Block a user