From 5384232eec4dff669cd2bb68ee93c34b6b63c78c Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 12 Aug 2026 02:51:50 +0000 Subject: Collect services from all systemd targets --- tests/compare.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/compare.rs') diff --git a/tests/compare.rs b/tests/compare.rs index fded37f..37135a7 100644 --- a/tests/compare.rs +++ b/tests/compare.rs @@ -290,6 +290,28 @@ fn native_manifest_collection_excludes_internal_members_from_its_archive_facts() .all(|record| !record.path.starts_with(".host/") && !record.path.starts_with(".fakedata/"))); } +#[test] +fn rootfs_collection_recognizes_services_enabled_by_non_default_targets() { + let fixture = tempdir().expect("temporary directory"); + let rootfs = fixture.path().join("rootfs"); + let wants = rootfs.join("etc/systemd/system/graphical.target.wants"); + 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(&rootfs, vec![], None, &artifact) + .expect("collect native filesystem and archive facts"); + + assert_eq!(manifest.services, vec![ServiceRecord::new("controller.service", true)]); +} + #[test] fn archive_collection_coalesces_a_service_enabled_by_multiple_targets() { let fixture = tempdir().expect("temporary directory"); -- cgit v1.2.3