Skip to content

Commit

Permalink
disable test since it require root and we can't run that in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
korewaChino committed Jul 2, 2024
1 parent ebe6e50 commit 39d3da1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,23 @@ impl Drop for Container {
}
}


// We can't really reproduce this test in a CI environment, so let's just ignore it
#[cfg(test)]
// Test only if we're running as root
mod tests {
use super::*;
use std::fs::File;
use std::io::{Read, Write};
use std::path::PathBuf;
#[cfg_attr(not(feature = "root"), ignore)]
#[ignore = "This test requires root"]
#[test]
fn test_container() {
std::fs::create_dir_all("/tmp/tiffin").unwrap();
let mut container = Container::new(PathBuf::from("/tmp/tiffin"));
container.chroot().unwrap();
container
.run(|| {
std::fs::create_dir_all("/tmp/tiffin/test").unwrap();
Ok(())
})
.unwrap();
}
}

0 comments on commit 39d3da1

Please sign in to comment.