MCPcopy Create free account
hub / github.com/bootc-dev/bootc / test_missing

Function test_missing

crates/sysusers/src/lib.rs:633–679  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

631
632 #[test]
633 fn test_missing() -> Result<()> {
634 let root = &newroot()?;
635
636 let a = analyze(&root).unwrap();
637 assert!(a.is_empty());
638
639 root.write(
640 "etc/passwd",
641 indoc! { r#"
642 root:x:0:0:Super User:/root:/bin/bash
643 passim:x:982:982:Local Caching Server:/usr/share/empty:/usr/bin/nologin
644 avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
645 "#},
646 )?;
647 root.write(
648 "etc/group",
649 indoc! { r#"
650 root:x:0:
651 adm:x:4:
652 wheel:x:10:
653 sudo:x:16:
654 systemd-journal:x:190:
655 printadmin:x:983:
656 rpc:x:32:
657 passim:x:982:
658 avahi:x:70:
659 sshd:x:981:
660 "#},
661 )?;
662
663 let a = analyze(&root).unwrap();
664 assert!(!a.is_empty());
665 let missing = a.missing_users.iter().map(|s| s.as_str());
666 assert!(missing.eq(["avahi", "passim"]));
667 let missing = a.missing_groups.iter().map(|s| s.as_str());
668 assert!(missing.eq([
669 "avahi",
670 "passim",
671 "printadmin",
672 "rpc",
673 "sshd",
674 "sudo",
675 "systemd-journal"
676 ]));
677
678 Ok(())
679 }
680}

Callers

nothing calls this directly

Calls 3

analyzeFunction · 0.85
newrootFunction · 0.70
iterMethod · 0.45

Tested by

no test coverage detected