summaryrefslogtreecommitdiff
path: root/tests/archive.rs
diff options
context:
space:
mode:
authorHermes Agent <hermes@localhost>2026-08-12 07:48:21 +0000
committerHermes Agent <hermes@localhost>2026-08-12 07:48:21 +0000
commitf967d698efd44473a9285e02d0109f3bb0641622 (patch)
treec94975571db9426cf71b15c9e6d16346e438c7c6 /tests/archive.rs
parent5e6cae20331f8e7cfd551b4656f0de852a4ad44c (diff)
Format native builder and satisfy clippy
Diffstat (limited to 'tests/archive.rs')
-rw-r--r--tests/archive.rs47
1 files changed, 38 insertions, 9 deletions
diff --git a/tests/archive.rs b/tests/archive.rs
index 6e59837..83f6722 100644
--- a/tests/archive.rs
+++ b/tests/archive.rs
@@ -20,10 +20,17 @@ fn writes_deterministic_tar_with_files_directories_and_symlinks() {
let first = fixture.path().join("first.tar");
let second = fixture.path().join("second.tar");
- NativeTarWriter::new().write(&rootfs, &first).expect("write first archive");
- NativeTarWriter::new().write(&rootfs, &second).expect("write second archive");
+ NativeTarWriter::new()
+ .write(&rootfs, &first)
+ .expect("write first archive");
+ NativeTarWriter::new()
+ .write(&rootfs, &second)
+ .expect("write second archive");
- assert_eq!(fs::read(&first).expect("read first"), fs::read(&second).expect("read second"));
+ assert_eq!(
+ fs::read(&first).expect("read first"),
+ fs::read(&second).expect("read second")
+ );
let mut archive = Archive::new(fs::File::open(first).expect("open archive"));
let entries = archive
@@ -32,7 +39,13 @@ fn writes_deterministic_tar_with_files_directories_and_symlinks() {
.map(|entry| {
let entry = entry.expect("read entry");
let path = entry.path().expect("entry path").into_owned();
- (path, entry.header().entry_type(), entry.header().mtime().expect("mtime"), entry.header().uid().expect("uid"), entry.header().gid().expect("gid"))
+ (
+ path,
+ entry.header().entry_type(),
+ entry.header().mtime().expect("mtime"),
+ entry.header().uid().expect("uid"),
+ entry.header().gid().expect("gid"),
+ )
})
.collect::<Vec<_>>();
@@ -78,7 +91,10 @@ fn preserves_hardlinks_in_the_archive() {
(
entry.path().expect("entry path").into_owned(),
entry.header().entry_type(),
- entry.link_name().expect("entry link name").map(|path| path.into_owned()),
+ entry
+ .link_name()
+ .expect("entry link name")
+ .map(|path| path.into_owned()),
)
})
.collect::<Vec<_>>();
@@ -102,7 +118,10 @@ fn preserves_hardlinks_in_the_archive() {
fn rejects_a_missing_rootfs() {
let fixture = tempdir().expect("fixture directory");
let error = NativeTarWriter::new()
- .write(fixture.path().join("missing"), fixture.path().join("image.tar"))
+ .write(
+ fixture.path().join("missing"),
+ fixture.path().join("image.tar"),
+ )
.expect_err("missing rootfs must fail");
assert!(error.to_string().contains("rootfs is not a directory"));
}
@@ -119,7 +138,11 @@ fn rejects_an_archive_output_inside_the_rootfs() {
.write(&rootfs, &artifact)
.expect_err("archive output inside rootfs must be rejected");
- assert!(error.to_string().contains("archive output must not be inside rootfs"));
+ assert!(
+ error
+ .to_string()
+ .contains("archive output must not be inside rootfs")
+ );
assert!(!artifact.exists());
assert!(!rootfs.join("controller.tar.partial").exists());
}
@@ -138,7 +161,10 @@ fn refuses_to_replace_an_existing_archive() {
.expect_err("an existing archive must not be replaced");
assert!(error.to_string().contains("archive output already exists"));
- assert_eq!(fs::read_to_string(&artifact).expect("read existing artifact"), "existing artifact");
+ assert_eq!(
+ fs::read_to_string(&artifact).expect("read existing artifact"),
+ "existing artifact"
+ );
assert!(!fixture.path().join("controller.tar.partial").exists());
}
@@ -155,5 +181,8 @@ fn removes_partial_output_when_an_unsupported_entry_stops_packaging() {
.expect_err("socket entries must be rejected");
assert!(error.to_string().contains("unsupported rootfs entry type"));
- assert!(!artifact.exists(), "failed packaging must not publish a partial archive");
+ assert!(
+ !artifact.exists(),
+ "failed packaging must not publish a partial archive"
+ );
}