test_workspace_stress.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """Stress tests for workspace lanes (§MR.10 stress).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import json |
| 6 | import time |
| 7 | from pathlib import Path |
| 8 | |
| 9 | import yaml |
| 10 | |
| 11 | from tools.workspace.manifest import validate_manifest_dict |
| 12 | from tools.workspace.check_next import check_next, build_status_report |
| 13 | from tools.workspace.manifest import load_manifest_file |
| 14 | from tests.fixtures.workspace import build_two_repo_constellation |
| 15 | from adapters.config import load_config |
| 16 | |
| 17 | |
| 18 | def test_large_manifest_bounded(tmp_path: Path) -> None: |
| 19 | members = [] |
| 20 | for i in range(25): |
| 21 | members.append( |
| 22 | { |
| 23 | "id": f"m{i}", |
| 24 | "role": "product_order" if i == 0 else "other", |
| 25 | "root": str(tmp_path / f"m{i}"), |
| 26 | "regime": "git-only", |
| 27 | "required": False, |
| 28 | "relay": False, |
| 29 | } |
| 30 | ) |
| 31 | lanes = [{"id": f"lane{i}", "primary": i == 0} for i in range(12)] |
| 32 | raw = { |
| 33 | "overseer_workspace_version": 1, |
| 34 | "id": "big", |
| 35 | "product_order_member": "m0", |
| 36 | "members": members, |
| 37 | "lanes": lanes, |
| 38 | } |
| 39 | start = time.perf_counter() |
| 40 | manifest = validate_manifest_dict( |
| 41 | raw, source_path=tmp_path / "workspace.yaml", manifest_source="local_workspace" |
| 42 | ) |
| 43 | elapsed = time.perf_counter() - start |
| 44 | assert len(manifest.members) == 25 |
| 45 | assert len(manifest.lanes) == 12 |
| 46 | assert elapsed < 1.0 |
| 47 | |
| 48 | |
| 49 | def test_status_json_key_order_stable(tmp_path: Path) -> None: |
| 50 | fx = build_two_repo_constellation(tmp_path) |
| 51 | cfg = load_config(fx["scooling"] / ".overseer" / "config.yaml") |
| 52 | a = json.dumps(build_status_report(cfg, fx["scooling"]).to_json(), sort_keys=True) |
| 53 | b = json.dumps(build_status_report(cfg, fx["scooling"]).to_json(), sort_keys=True) |
| 54 | assert a == b |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago