2026-03-06 17:28:17 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ROOT_DIR = Path(__file__).resolve().parents[4]
|
|
|
|
|
APP_SCRIPT = ROOT_DIR / "infra" / "scripts" / "app.sh"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_worker_commands_use_taskiq() -> None:
|
|
|
|
|
content = APP_SCRIPT.read_text(encoding="utf-8")
|
2026-03-10 17:44:29 +08:00
|
|
|
removed_runner = "uv run celery"
|
2026-03-06 17:28:17 +08:00
|
|
|
|
|
|
|
|
assert "uv run taskiq worker" in content
|
|
|
|
|
assert "core.taskiq.app:critical_broker" in content
|
|
|
|
|
assert "core.taskiq.app:default_broker" in content
|
|
|
|
|
assert "core.taskiq.app:bulk_broker" in content
|
2026-03-10 17:44:29 +08:00
|
|
|
assert 'pgrep -f "uv run taskiq worker core.taskiq.app:"' in content
|
|
|
|
|
assert 'kill_pids_gracefully "taskiq workers"' in content
|
|
|
|
|
assert "gunicorn" not in content
|
2026-03-06 17:28:17 +08:00
|
|
|
assert removed_runner not in content
|
2026-03-06 17:55:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_web_command_uses_uvicorn_only() -> None:
|
|
|
|
|
content = APP_SCRIPT.read_text(encoding="utf-8")
|
|
|
|
|
|
|
|
|
|
assert "uv run uvicorn app:app" in content
|
|
|
|
|
assert 'WEB_PORT="${SOCIAL_WEB__PORT:-5775}"' in content
|
|
|
|
|
assert "SOCIAL_WEB__WORKERS" in content
|
|
|
|
|
assert 'UVICORN_LOG_LEVEL="${UVICORN_LOG_LEVEL,,}"' in content
|
|
|
|
|
assert "SOCIAL_WEB__GUNICORN__" not in content
|
|
|
|
|
assert "uv run gunicorn" not in content
|