Round 3 fixes: cancelled polling, aggregator invalid_count, filter state, scheduler atomicity, HTTP exception handler, tests
This commit is contained in:
@@ -73,6 +73,25 @@ class TestSchedulerAPI:
|
||||
assert data["code"] == 200
|
||||
assert data["data"]["started"] is True
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_validate_now_returns_valid_job(self, client):
|
||||
"""测试 POST /api/scheduler/validate-now 返回有效 job_id"""
|
||||
await client.post("/api/scheduler/start")
|
||||
response = await client.post("/api/scheduler/validate-now")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["code"] == 200
|
||||
job_id = data["data"]["job_id"]
|
||||
assert isinstance(job_id, str) and len(job_id) > 0
|
||||
|
||||
# 通过应用状态验证 job 已被提交到 executor
|
||||
from app.api.main import create_app
|
||||
# 使用 client 的 app 实例
|
||||
app = client._transport.app
|
||||
executor = app.state.executor
|
||||
job = executor.get_job(job_id)
|
||||
assert job is not None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_scheduler_full_workflow(self, client):
|
||||
"""测试调度器完整工作流"""
|
||||
|
||||
Reference in New Issue
Block a user