Skip to content

Commit

Permalink
Merge pull request #472 from tsturzl/fix_test_make_parent_mount_private
Browse files Browse the repository at this point in the history
Fix test_make_parent_mount_private
  • Loading branch information
tommady committed Nov 13, 2021
2 parents 73e4a86 + f1c662b commit afe4921
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions crates/libcontainer/src/rootfs/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,22 +528,24 @@ mod tests {
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
let set = m
.syscall
.as_any()
.downcast_ref::<TestHelperSyscall>()
.unwrap()
.get_mount_args();

assert_eq!(got.len(), 1);
assert_eq!(want, got[0]);
assert_eq!(set.len(), 1);

let got = &set[0];
assert_eq!(got.source, None);
assert_eq!(got.fstype, None);
assert_eq!(got.flags, MsFlags::MS_PRIVATE);
assert_eq!(got.data, None);

// This can be either depending on the system, some systems mount tmpfs at /tmp others it's
// a plain directory. See https://github.com/containers/youki/issues/471
assert!(got.target == PathBuf::from("/") || got.target == PathBuf::from("/tmp"));
}

#[test]
Expand Down

0 comments on commit afe4921

Please sign in to comment.