test_q4b_ui_performance.py python
48 lines 1.5 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 2 days ago
1 """Performance tests for Track Q / Q4b Path B UI redesign (§Q4A.15)."""
2
3 from __future__ import annotations
4
5 import time
6 import urllib.request
7 from pathlib import Path
8
9 from tests.fixtures.app import seed_app_repo, start_test_app
10
11 # Same latency class as Track Q / Q1 static/status bounds (§Q0.12 / §Q4A.15).
12 STATIC_ASSET_BOUND_SEC = 1.0
13 INDEX_BOUND_SEC = 1.0
14
15 DIAGRAMS = (
16 "lanes.svg",
17 "regimes.svg",
18 "layers.svg",
19 "kit-consumer.svg",
20 )
21
22
23 def test_index_and_diagrams_within_bound(tmp_path: Path) -> None:
24 seed_app_repo(tmp_path)
25 handle, client = start_test_app(tmp_path)
26 try:
27 start = time.monotonic()
28 request = urllib.request.Request(
29 f"{client.base_url}/",
30 headers={"Authorization": f"Bearer {client.session}"},
31 )
32 with urllib.request.urlopen(request, timeout=5) as response:
33 assert response.status == 200
34 assert b"Overseer Kit" in response.read()
35 assert time.monotonic() - start < INDEX_BOUND_SEC
36
37 for name in DIAGRAMS:
38 start = time.monotonic()
39 svg_req = urllib.request.Request(
40 f"{client.base_url}/assets/diagrams/{name}",
41 headers={"Authorization": f"Bearer {client.session}"},
42 )
43 with urllib.request.urlopen(svg_req, timeout=5) as response:
44 assert response.status == 200
45 assert b"<svg" in response.read()
46 assert time.monotonic() - start < STATIC_ASSET_BOUND_SEC
47 finally:
48 handle.shutdown()
File History 1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 2 days ago