diff options
| author | Hermes Agent <hermes@localhost> | 2026-08-12 02:44:26 +0000 |
|---|---|---|
| committer | Hermes Agent <hermes@localhost> | 2026-08-12 02:44:26 +0000 |
| commit | 450a5b27e101e7b40cd2d035056c4141e9477f6a (patch) | |
| tree | 8c8ca9a46fa631b366317e4ba0ca5ba57c5ea066 /tests | |
| parent | 2a3fb3adabb0aa17113032ad785458556fb6372e (diff) | |
Coalesce duplicate enabled service facts
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compare.rs | 23 |
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)]); +} |