test: verify live chat agent MCP and task load flows

This commit is contained in:
2026-09-06 23:25:17 +08:00
parent cec8daac93
commit 266608b6e8
2 changed files with 83 additions and 3 deletions
+8 -3
View File
@@ -46,11 +46,15 @@ async def main(args):
timings[kind].append((perf_counter()-start)*1000)
response.raise_for_status()
return response.json()
health_stop = asyncio.Event()
async def health():
while True:
while not health_stop.is_set():
try: await request('GET', '/health', 'health')
except httpx.HTTPError as error: errors.append(type(error).__name__)
await asyncio.sleep(.05)
try:
await asyncio.wait_for(health_stop.wait(), timeout=.05)
except TimeoutError:
pass
heartbeat = asyncio.create_task(health())
start = perf_counter()
try:
@@ -72,7 +76,8 @@ async def main(args):
remaining = await request('GET', '/api/tasks', 'list')
assert remaining['page']['total'] == 0
finally:
heartbeat.cancel(); await asyncio.gather(heartbeat, return_exceptions=True)
health_stop.set()
await asyncio.wait_for(heartbeat, timeout=35)
report = {'transport': 'real loopback HTTP, separate Uvicorn process', 'tasks': args.count,
'concurrency': args.concurrency, 'elapsed_ms': round((perf_counter()-start)*1000, 2),
'latencies': {key: stats(value) for key,value in timings.items()}, 'health_errors': errors,