mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Add SPDX-License-Identifier for all existing codes. Fixes: #2 Signed-off-by: bin liu <bin@hyper.sh>
23 lines
687 B
Rust
23 lines
687 B
Rust
// Copyright (c) 2018 Levente Kurusa
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0 or MIT
|
|
//
|
|
|
|
use cgroups::cpuset::CpuSetController;
|
|
use cgroups::error::ErrorKind;
|
|
use cgroups::Cgroup;
|
|
|
|
#[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_eq!(res.unwrap_err().kind(), &ErrorKind::InvalidOperation);
|
|
}
|
|
cg.delete();
|
|
}
|