summaryrefslogtreecommitdiff
path: root/tests/compare.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compare.rs')
-rw-r--r--tests/compare.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/compare.rs b/tests/compare.rs
index 0bb2fff..fded37f 100644
--- a/tests/compare.rs
+++ b/tests/compare.rs
@@ -289,3 +289,26 @@ fn native_manifest_collection_excludes_internal_members_from_its_archive_facts()
.iter()
.all(|record| !record.path.starts_with(".host/") && !record.path.starts_with(".fakedata/")));
}
+
+#[test]
+fn archive_collection_coalesces_a_service_enabled_by_multiple_targets() {
+ let fixture = tempdir().expect("temporary directory");
+ let rootfs = fixture.path().join("rootfs");
+ for target in ["multi-user.target.wants", "graphical.target.wants"] {
+ let wants = rootfs.join("etc/systemd/system").join(target);
+ fs::create_dir_all(&wants).expect("create service state directory");
+ symlink(
+ "/usr/lib/systemd/system/controller.service",
+ wants.join("controller.service"),
+ )
+ .expect("enable service");
+ }
+ let artifact = fixture.path().join("controller.tar");
+ NativeTarWriter::new()
+ .write(&rootfs, &artifact)
+ .expect("write native archive");
+
+ let manifest = ArtifactManifest::collect_archive(&artifact).expect("collect archive facts");
+
+ assert_eq!(manifest.services, vec![ServiceRecord::new("controller.service", true)]);
+}