Files
VoiceStudio/tests/test_model_install_dedup.py
T
Palash Debnath 5a615d2c66 feat(workers): package headless GPU nodes (#1638) (#1648)
Closes #1638.\n\nPackages headless GPU workers with durable enrollment, bounded artifact handling, cross-platform lifecycle cleanup, and regression coverage. Incorporates CodeRabbit, Greptile, CodeQL, and platform-CI findings before merge.
2026-08-24 16:32:56 +05:30

30 lines
990 B
Python

import asyncio
def test_cancel_before_task_publication_revokes_the_next_generation():
from api.routers.setup import download
repo_id = download.KNOWN_MODELS[0]["repo_id"]
download._cancelled.discard(repo_id)
try:
asyncio.run(download.cancel_install_and_wait(repo_id))
assert repo_id in download._cancelled
finally:
download._cancelled.discard(repo_id)
def test_duplicate_model_install_reuses_the_running_worker():
from api.routers.setup import download
repo_id = download.KNOWN_MODELS[0]["repo_id"]
download._install_cooldowns.pop(repo_id, None)
with download._active_installs_lock:
download._active_installs.add(repo_id)
try:
result = asyncio.run(download.install_model(download.InstallModelRequest(repo_id=repo_id)))
finally:
with download._active_installs_lock:
download._active_installs.discard(repo_id)
assert result == {"status": "already_running", "repo_id": repo_id}