Skip to content

Commit

Permalink
wtf
Browse files Browse the repository at this point in the history
  • Loading branch information
korewaChino committed Jul 2, 2024
1 parent 12019c4 commit dc7a4e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
container:
image: rust:latest
# Since this crate creates a new chroot, it needs to be run in a privileged container
options: --privileged
options: --privileged --security-opt seccomp=unconfined --user root
steps:
- name: Install dependencies
run: |
Expand Down
16 changes: 3 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,19 +376,9 @@ mod tests {
#[cfg_attr(not(feature = "root"), ignore)]
#[test]
fn test_container() {
std::fs::create_dir_all("/tmp/tiffin").unwrap();
let mut container = Container::new(PathBuf::from("/tmp/tiffin"));
container.host_bind_mount();
container
.run(|| {
let mut file = File::create("/run/host/test.txt").unwrap();
file.write_all(b"Hello, world!").unwrap();
Ok(())
})
.unwrap();

let mut file = File::open("/tmp/tiffin/run/host/test.txt").unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
assert_eq!(contents, "Hello, world!");
container.chroot().unwrap();

}
}

0 comments on commit dc7a4e6

Please sign in to comment.