from gpustack.cmd.prerun import prepare_s6_overlay def test_prepare_s6_overlay_enables_dependency_only_services(tmp_path): s6_base_path = tmp_path / "s6-rc.d" user_contents = s6_base_path / "user" / "contents.d" user_contents.mkdir(parents=True) stale_migration = user_contents / "gpustack-migration" stale_migration.write_text("") # prepare_s6_overlay should cleanup the base dir and generate base on the input services prepare_s6_overlay(["postgres"], ["gpustack-migration"], s6_base_path) assert (user_contents / "postgres").exists() assert (user_contents / "gpustack-migration").exists() def test_prepare_s6_overlay_cleans_dependency_only_services(tmp_path): s6_base_path = tmp_path / "s6-rc.d" user_contents = s6_base_path / "user" / "contents.d" user_contents.mkdir(parents=True) (user_contents / "gpustack-migration").write_text("") prepare_s6_overlay(["postgres"], [], s6_base_path) assert (user_contents / "postgres").exists() assert not (user_contents / "gpustack-migration").exists()