feat: Carry runnable lab5 business stack into lab6 (U1)
Import committed lab5 baseline 03899d7 via git archive: API replicas, PostgreSQL, private S3, RabbitMQ, publisher, worker, migrations, and hooks. Preserve lab6 contracts and the separate telemetry stack. Static checks pass; Docker runtime integration remains pending.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Keep broker messages within the public job schema and free of file data."""
|
||||
|
||||
import json
|
||||
import sys
|
||||
import unittest
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
sys.path.insert(0, str(ROOT / "tests"))
|
||||
from client import validate # noqa: E402
|
||||
from src.pipeline_jobs import job_payload # noqa: E402
|
||||
|
||||
|
||||
class OutboxPayloadTest(unittest.TestCase):
|
||||
def test_job_message_has_only_contract_fields(self):
|
||||
schema = json.loads((ROOT / "contracts/jobs.schema.json").read_text(encoding="utf-8"))
|
||||
row = {
|
||||
"job_id": uuid4(), "attachment_id": uuid4(), "pipeline_version": 2,
|
||||
"attempt": 3, "created_at": datetime.now(timezone.utc),
|
||||
"object_key": "staging/must-not-leak", "bytes": b"must-not-leak",
|
||||
}
|
||||
message = job_payload(row)
|
||||
validate(message, schema)
|
||||
self.assertEqual(set(message), set(schema["required"]))
|
||||
self.assertNotIn("staging", json.dumps(message))
|
||||
self.assertNotIn("bytes", json.dumps(message))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user