test_upgrade_regime_stress.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
12 hours ago
| 1 | """Stress — Track O / O3 upgrade-regime dry-run repeats (§O2.9 stress).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import time |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from cli.kit_root import kit_root |
| 9 | from tests.support import ( |
| 10 | FIXTURES, |
| 11 | make_runner, |
| 12 | muse_mirror_status_runner, |
| 13 | muse_status_runner, |
| 14 | ok, |
| 15 | run_cli, |
| 16 | seed_muse_substrate, |
| 17 | ) |
| 18 | |
| 19 | N = 20 |
| 20 | MAX_TOTAL_SECONDS = 60.0 |
| 21 | |
| 22 | |
| 23 | def _init_muse_only(tmp_path: Path) -> None: |
| 24 | seed_muse_substrate(tmp_path) |
| 25 | assert ( |
| 26 | run_cli( |
| 27 | [ |
| 28 | "init", |
| 29 | "--from-config", |
| 30 | str(FIXTURES / "config-muse-only.yaml"), |
| 31 | "--non-interactive", |
| 32 | ], |
| 33 | cwd=tmp_path, |
| 34 | kit=kit_root(), |
| 35 | runner=muse_status_runner(tmp_path), |
| 36 | ) |
| 37 | == 0 |
| 38 | ) |
| 39 | |
| 40 | |
| 41 | def test_dry_run_repeated_n_times_bounded(tmp_path: Path) -> None: |
| 42 | _init_muse_only(tmp_path) |
| 43 | base = muse_mirror_status_runner(tmp_path) |
| 44 | responses = dict(base.responses) |
| 45 | responses["git remote get-url origin"] = ok("[email protected]:o/r.git") |
| 46 | runner = make_runner(responses) |
| 47 | argv = [ |
| 48 | "upgrade-regime", |
| 49 | "--from", |
| 50 | "muse-only", |
| 51 | "--to", |
| 52 | "muse+git-mirror", |
| 53 | "--dry-run", |
| 54 | ] |
| 55 | start = time.perf_counter() |
| 56 | for _ in range(N): |
| 57 | code = run_cli(argv, cwd=tmp_path, kit=kit_root(), runner=runner) |
| 58 | assert code == 0 |
| 59 | elapsed = time.perf_counter() - start |
| 60 | assert elapsed < MAX_TOTAL_SECONDS, f"stress exceeded bound: {elapsed:.2f}s" |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
12 hours ago