test_prerun.py 1.0 KB

12345678910111213141516171819202122232425262728
  1. from gpustack.cmd.prerun import prepare_s6_overlay
  2. def test_prepare_s6_overlay_enables_dependency_only_services(tmp_path):
  3. s6_base_path = tmp_path / "s6-rc.d"
  4. user_contents = s6_base_path / "user" / "contents.d"
  5. user_contents.mkdir(parents=True)
  6. stale_migration = user_contents / "gpustack-migration"
  7. stale_migration.write_text("")
  8. # prepare_s6_overlay should cleanup the base dir and generate base on the input services
  9. prepare_s6_overlay(["postgres"], ["gpustack-migration"], s6_base_path)
  10. assert (user_contents / "postgres").exists()
  11. assert (user_contents / "gpustack-migration").exists()
  12. def test_prepare_s6_overlay_cleans_dependency_only_services(tmp_path):
  13. s6_base_path = tmp_path / "s6-rc.d"
  14. user_contents = s6_base_path / "user" / "contents.d"
  15. user_contents.mkdir(parents=True)
  16. (user_contents / "gpustack-migration").write_text("")
  17. prepare_s6_overlay(["postgres"], [], s6_base_path)
  18. assert (user_contents / "postgres").exists()
  19. assert not (user_contents / "gpustack-migration").exists()