from pathlib import Path ROLE = Path("roles/nfs_stability/tasks/main.yml").read_text() SITE = Path("site.yml").read_text() def test_recovery_is_non_destructive(): assert "systemctl restart" not in ROLE assert "OnUnitActiveSec" not in ROLE assert "systemctl start" in ROLE def test_recovery_validates_real_nfs_and_mergerfs_mounts(): assert "-t nfs,nfs4" in ROLE assert "-t fuse.mergerfs" in ROLE assert all(path in ROLE for path in ("/mnt/nas", "/mnt/qnap1", "/mnt/qnap2", "/mnt/media")) def test_legacy_loop_is_stopped_before_replacement(): stop_at = ROLE.index("Stop and disable the destructive legacy retry timer first") install_at = ROLE.index("Install once-per-boot NFS recovery timer") assert stop_at < install_at def test_role_is_scoped_to_media_mount_hosts(): assert "hosts: emby-sascha:emby-chris:arrapps" in SITE assert "- nfs_stability" in SITE