test_hosted_dashboard_performance.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """Performance tests for hosted governance dashboard (§HGD.12).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import time |
| 6 | |
| 7 | from tests.fixtures.hosted_dashboard import free_port, start_test_hosted |
| 8 | |
| 9 | |
| 10 | # Documented bounds (fixture, no network). |
| 11 | SINGLE_REPO_DOC_FETCH_MS = 2000 |
| 12 | STARTUP_LISTEN_MS = 2000 |
| 13 | |
| 14 | |
| 15 | def test_single_repo_doc_fetch_bound() -> None: |
| 16 | handle, client, _ = start_test_hosted() |
| 17 | try: |
| 18 | started = time.perf_counter() |
| 19 | status, _ = client.get("/api/repos/acme/kit-demo/roadmap") |
| 20 | elapsed_ms = (time.perf_counter() - started) * 1000 |
| 21 | assert status == 200 |
| 22 | assert elapsed_ms < SINGLE_REPO_DOC_FETCH_MS |
| 23 | finally: |
| 24 | handle.shutdown() |
| 25 | |
| 26 | |
| 27 | def test_startup_listen_bound() -> None: |
| 28 | started = time.perf_counter() |
| 29 | handle, client, _ = start_test_hosted(port=free_port()) |
| 30 | try: |
| 31 | elapsed_ms = (time.perf_counter() - started) * 1000 |
| 32 | status, _ = client.get("/api/health", auth=False) |
| 33 | assert status == 200 |
| 34 | assert elapsed_ms < STARTUP_LISTEN_MS |
| 35 | finally: |
| 36 | handle.shutdown() |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago