-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: higuruchi <[email protected]>
- Loading branch information
Showing
7 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
tests/rust-integration-tests/integration_test/src/tests/domainname/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use crate::utils::test_inside_container; | ||
use oci_spec::runtime::{ | ||
Capability, LinuxBuilder, LinuxCapabilitiesBuilder, ProcessBuilder, Spec, SpecBuilder, | ||
}; | ||
use std::collections::hash_set::HashSet; | ||
use test_framework::{Test, TestGroup, TestResult}; | ||
|
||
fn get_spec(domainname: &str) -> Spec { | ||
let caps = vec![ | ||
Capability::AuditWrite, | ||
Capability::Kill, | ||
Capability::NetBindService, | ||
]; | ||
let mut cap_bounding = HashSet::new(); | ||
let mut cap_effective = HashSet::new(); | ||
let mut cap_permitted = HashSet::new(); | ||
|
||
for cap in caps { | ||
cap_bounding.insert(cap); | ||
cap_effective.insert(cap); | ||
cap_permitted.insert(cap); | ||
} | ||
|
||
SpecBuilder::default() | ||
.domainname(domainname) | ||
.linux( | ||
LinuxBuilder::default() | ||
.readonly_paths(vec![]) | ||
.build() | ||
.expect("error in building linux config"), | ||
) | ||
.process( | ||
ProcessBuilder::default() | ||
.args(vec![ | ||
"runtimetest".to_string(), | ||
"domainname_test".to_string(), | ||
]) | ||
.capabilities( | ||
LinuxCapabilitiesBuilder::default() | ||
.bounding(cap_bounding) | ||
.effective(cap_effective) | ||
.permitted(cap_permitted) | ||
.build() | ||
.unwrap(), | ||
) | ||
.rlimits(vec![]) | ||
.no_new_privileges(true) | ||
.build() | ||
.expect("error in creating process config"), | ||
) | ||
.build() | ||
.unwrap() | ||
} | ||
|
||
fn set_domainname_test() -> TestResult { | ||
let spec = get_spec("domainname"); | ||
test_inside_container(spec, &|_| Ok(())) | ||
} | ||
|
||
pub fn get_domainname_tests() -> TestGroup { | ||
let mut tg = TestGroup::new("domainname_test"); | ||
let set_domainname_test = Test::new("set_domainname_test", Box::new(set_domainname_test)); | ||
tg.add(vec![Box::new(set_domainname_test)]); | ||
|
||
tg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod cgroups; | ||
pub mod domainname; | ||
pub mod hooks; | ||
pub mod hostname; | ||
pub mod lifecycle; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters