docs: apply fleet-template (16-artifact scaffold)
Adds missing standard artifacts: - README.md (if missing) - AGENTS.md (AI agent contract) - PLAN.md (current sprint) - STATUS.md (where we are) - DEVELOPMENT.md (dev workflow) - DEPLOYMENT.md (deploy procedure) - TESTING.md (test strategy) - DECISIONS.md (ADR index + templates) - .github/CODEOWNERS - .github/workflows/ci.yml Preserves all existing artifacts. Refs: RugMunchMedia/fleet-template
This commit is contained in:
commit
47ba268131
310 changed files with 38429 additions and 0 deletions
59
tests/test_jobqueue.py
Normal file
59
tests/test_jobqueue.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import pytest
|
||||
|
||||
from jobqueue import JobQueue
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobqueue_create_job_returns_id() -> None:
|
||||
q = JobQueue()
|
||||
job_id = await q.create_job("scrape", {"url": "https://example.com"})
|
||||
assert job_id.startswith("job_")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobqueue_get_job_exists() -> None:
|
||||
q = JobQueue()
|
||||
job_id = await q.create_job("scrape", {"url": "https://example.com"})
|
||||
job = await q.get_job(job_id)
|
||||
assert job is not None
|
||||
assert job["type"] == "scrape"
|
||||
assert job["status"] == "pending"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobqueue_get_job_missing() -> None:
|
||||
q = JobQueue()
|
||||
job = await q.get_job("nonexistent")
|
||||
assert job is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobqueue_complete_job() -> None:
|
||||
q = JobQueue()
|
||||
job_id = await q.create_job("scrape", {"url": "https://example.com"})
|
||||
await q.complete_job(job_id, {"content": "test"})
|
||||
job = await q.get_job(job_id)
|
||||
assert job["status"] == "completed"
|
||||
assert job["result"]["content"] == "test"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobqueue_fail_job() -> None:
|
||||
q = JobQueue()
|
||||
job_id = await q.create_job("scrape", {"url": "https://example.com"})
|
||||
await q.fail_job(job_id, "network error")
|
||||
job = await q.get_job(job_id)
|
||||
assert job["status"] == "failed"
|
||||
assert "network" in job["error"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobqueue_update_preserves_fields() -> None:
|
||||
q = JobQueue()
|
||||
job_id = await q.create_job(
|
||||
"crawl", {"url": "https://example.com"}, webhook="https://hook.example.com"
|
||||
)
|
||||
await q.update_job(job_id, status="running")
|
||||
job = await q.get_job(job_id)
|
||||
assert job["status"] == "running"
|
||||
assert job["webhook"] == "https://hook.example.com"
|
||||
Loading…
Add table
Add a link
Reference in a new issue