mirror of
https://github.com/containers/youki
synced 2024-11-23 17:32:15 +01:00
adding test_setup_comount_symlinks
This commit is contained in:
parent
b36b9dbd01
commit
efc634dc41
@ -406,11 +406,11 @@ mod tests {
|
||||
.unwrap();
|
||||
let mount_opts = &MountOptions {
|
||||
root: tmp_dir.path(),
|
||||
label: Some("something_test"),
|
||||
label: Some("default"),
|
||||
cgroup_ns: false,
|
||||
};
|
||||
assert!(m
|
||||
.setup_namespaced_hierarchy(mount, mount_opts, "test_setup_namespaced_hierarchy")
|
||||
.setup_namespaced_hierarchy(mount, mount_opts, "cpu,cpuacct")
|
||||
.is_ok());
|
||||
|
||||
let want = MountArgs {
|
||||
@ -420,7 +420,7 @@ mod tests {
|
||||
.join("tmp/test_setup_namespaced_hierarchy/null"),
|
||||
fstype: None,
|
||||
flags: MsFlags::MS_NOEXEC | MsFlags::MS_NOSUID | MsFlags::MS_NODEV,
|
||||
data: Some("test_setup_namespaced_hierarchy,context=\"something_test\"".to_string()),
|
||||
data: Some("cpu,cpuacct,context=\"default\"".to_string()),
|
||||
};
|
||||
let got = m
|
||||
.syscall
|
||||
|
@ -160,4 +160,24 @@ mod tests {
|
||||
.get_symlink_args();
|
||||
assert_eq!(want, got)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_setup_comount_symlinks() {
|
||||
let tmp_dir = TempDir::new("/tmp/test_setup_default_symlinks").unwrap();
|
||||
let symlink = Symlink::new();
|
||||
assert!(symlink
|
||||
.setup_comount_symlinks(tmp_dir.path(), "cpu,cpuacct")
|
||||
.is_ok());
|
||||
let want = vec![
|
||||
(PathBuf::from("cpu,cpuacct"), tmp_dir.path().join("cpu")),
|
||||
(PathBuf::from("cpu,cpuacct"), tmp_dir.path().join("cpuacct")),
|
||||
];
|
||||
let got = symlink
|
||||
.syscall
|
||||
.as_any()
|
||||
.downcast_ref::<TestHelperSyscall>()
|
||||
.unwrap()
|
||||
.get_symlink_args();
|
||||
assert_eq!(want, got)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user