1
0
mirror of https://github.com/containers/youki synced 2024-11-23 17:32:15 +01:00

adding test_make_parent_mount_private

This commit is contained in:
tommady 2021-10-08 14:28:23 +00:00
parent c86c6bbdb8
commit 0550888bd3
No known key found for this signature in database
GPG Key ID: 15E4E2B7957CF963

@ -370,4 +370,28 @@ mod tests {
assert_eq!(got.len(), 2);
}
}
#[test]
fn test_make_parent_mount_private() {
let tmp_dir = TempDir::new("/tmp/test_make_parent_mount_private").unwrap();
let m = Mount::new();
assert!(m.make_parent_mount_private(tmp_dir.path()).is_ok());
let want = MountArgs {
source: None,
target: PathBuf::from("/"),
fstype: None,
flags: MsFlags::MS_PRIVATE,
data: None,
};
let got = m
.syscall
.as_any()
.downcast_ref::<TestHelperSyscall>()
.unwrap()
.get_mount_args();
assert_eq!(got.len(), 1);
assert_eq!(want, got[0]);
}
}