Files
alighasami 3d5eaf9445
Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

41 lines
1.3 KiB
Python

import asyncio
import textwrap
import aiohttp
import pytest
from src.nanoid import nanoid
from tests.integration.conftest import create_task_settings
@pytest.mark.asyncio
async def test_health_check_server_responds(broker, manager):
health_check_url = manager.get_health_check_url()
async with aiohttp.ClientSession() as session:
for _ in range(10):
try:
response = await session.get(health_check_url)
if response.status == 200:
assert await response.text() == "OK"
return
except aiohttp.ClientConnectionError:
await asyncio.sleep(0.1)
@pytest.mark.asyncio
async def test_health_check_server_ressponds_mid_execution(broker, manager):
task_id = nanoid()
code = textwrap.dedent("""
for _ in range(10_000_000):
pass
return [{"result": "completed"}]
""")
task_settings = create_task_settings(code=code, node_mode="all_items")
await broker.send_task(task_id=task_id, task_settings=task_settings)
await asyncio.sleep(0.3)
async with aiohttp.ClientSession() as session:
response = await session.get(manager.get_health_check_url())
assert response.status == 200
assert await response.text() == "OK"