summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHermes Agent <hermes@localhost>2026-08-12 01:59:47 +0000
committerHermes Agent <hermes@localhost>2026-08-12 01:59:47 +0000
commit271ccc76ad22436b7e0d5291168a5d18c57bb77b (patch)
treef5404caa27fc4e6e8470847d74ec8001c2c84948 /tests
parent04c6c5af37d9eac00a2bba2eaba1ec0836834633 (diff)
Compare semantic facts directly from tar artifacts
Diffstat (limited to 'tests')
-rw-r--r--tests/compare.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/compare.rs b/tests/compare.rs
index b11d288..59b62cb 100644
--- a/tests/compare.rs
+++ b/tests/compare.rs
@@ -120,3 +120,39 @@ fn collects_semantic_facts_from_native_rootfs_and_tar_artifact() {
.iter()
.any(|record| record == &ArchiveMemberRecord::new("etc/controller-link", "symlink")));
}
+
+#[test]
+fn collects_comparable_semantic_facts_directly_from_a_tar_artifact() {
+ let fixture = tempdir().expect("temporary directory");
+ let rootfs = fixture.path().join("rootfs");
+ fs::create_dir_all(rootfs.join("etc/systemd/system/multi-user.target.wants"))
+ .expect("create service state directory");
+ fs::create_dir_all(rootfs.join("boot")).expect("create boot directory");
+ fs::write(rootfs.join("etc/controller.conf"), "controller\n").expect("write file");
+ fs::write(rootfs.join("boot/initrd-rt.img"), "initrd\n").expect("write initrd");
+ symlink(
+ "/usr/lib/systemd/system/controller.service",
+ rootfs.join("etc/systemd/system/multi-user.target.wants/controller.service"),
+ )
+ .expect("enable service");
+ let artifact = fixture.path().join("controller.tar");
+ NativeTarWriter::new()
+ .write(&rootfs, &artifact)
+ .expect("write native tar");
+
+ let manifest = ArtifactManifest::collect_archive(&artifact).expect("collect archive facts");
+
+ assert_eq!(manifest.packages, Vec::<PackageRecord>::new());
+ assert!(manifest.files.iter().any(|record| record == &FileRecord::file(
+ "etc/controller.conf",
+ "2d5c759b2b539229e09d362e8dbe0ae410ff8c9ece6038624458724520683f5b",
+ )));
+ assert_eq!(
+ manifest.initrd,
+ Some(InitrdRecord::new(
+ "boot/initrd-rt.img",
+ "8f7ed204b9dfaa20aa484445f54233c4b407cb80ec0f8c07f1f0a59675fb44cf",
+ ))
+ );
+ assert_eq!(manifest.services, vec![ServiceRecord::new("controller.service", true)]);
+}