test_q1_app_performance.py python
54 lines 1.6 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 9 hours ago
1 """Performance tests for Track Q / Q1 overseer app (§Q0.12)."""
2
3 from __future__ import annotations
4
5 import time
6 from pathlib import Path
7
8 from tests.fixtures.app import seed_app_repo, start_test_app
9
10 # Documented bounds for fixture-sized repos (§Q0.12 performance tier).
11 STARTUP_BOUND_SEC = 2.0
12 STATUS_BOUND_SEC = 1.0
13 DOC_READ_BOUND_SEC = 1.0
14
15
16 def test_startup_listen_within_bound(tmp_path: Path) -> None:
17 seed_app_repo(tmp_path)
18 start = time.monotonic()
19 handle, client = start_test_app(tmp_path)
20 try:
21 status, payload = client.get("/api/health")
22 elapsed = time.monotonic() - start
23 assert status == 200
24 assert payload["result"]["status"] == "ok"
25 assert elapsed < STARTUP_BOUND_SEC
26 finally:
27 handle.shutdown()
28
29
30 def test_status_within_bound(tmp_path: Path) -> None:
31 seed_app_repo(tmp_path)
32 handle, client = start_test_app(tmp_path)
33 try:
34 start = time.monotonic()
35 status, payload = client.get("/api/status")
36 elapsed = time.monotonic() - start
37 assert status == 200
38 assert payload["result"]["initialized"] is True
39 assert elapsed < STATUS_BOUND_SEC
40 finally:
41 handle.shutdown()
42
43
44 def test_doc_read_within_bound(tmp_path: Path) -> None:
45 seed_app_repo(tmp_path)
46 handle, client = start_test_app(tmp_path)
47 try:
48 start = time.monotonic()
49 status, _payload = client.get("/api/docs/handover")
50 elapsed = time.monotonic() - start
51 assert status == 200
52 assert elapsed < DOC_READ_BOUND_SEC
53 finally:
54 handle.shutdown()
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 9 hours ago