From 3e17aa6c8bce257beb3aa80b3a3958c2acf7bb73 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 16 Jun 2026 22:26:04 -0400 Subject: [PATCH] test(tier2): add smoke e2e test (opt-in, double-gate TIER2_SANDBOX_TESTS+TIER2_SMOKE) --- tests/test_tier2_smoke_e2e.py | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/test_tier2_smoke_e2e.py diff --git a/tests/test_tier2_smoke_e2e.py b/tests/test_tier2_smoke_e2e.py new file mode 100644 index 00000000..2fad08c9 --- /dev/null +++ b/tests/test_tier2_smoke_e2e.py @@ -0,0 +1,56 @@ +"""Opt-in full-pipeline smoke test. + +Runs: +1. setup_tier2_clone.ps1 -WhatIf (verify the bootstrap script is well-formed) +2. run_track.py with the smoke track (verify the CLI runs the protocol) + +This test does NOT require a real Tier 2 clone (it uses a temp workspace). +""" +import os +import subprocess +from pathlib import Path + +import pytest + +pytestmark = [ + pytest.mark.skipif( + not os.environ.get("TIER2_SANDBOX_TESTS"), + reason="opt-in: smoke test off by default; set TIER2_SANDBOX_TESTS=1", + ), + pytest.mark.skipif( + not os.environ.get("TIER2_SMOKE"), + reason="opt-in: full e2e smoke test off; set TIER2_SANDBOX_TESTS=1 TIER2_SMOKE=1", + ), + pytest.mark.tier2_smoke, +] + + +def test_run_track_initializes_branch(tmp_path: Path) -> None: + """run_track.py creates the feature branch via git switch -c.""" + main_repo = tmp_path / "main" + main_repo.mkdir() + subprocess.run(["git", "init", "--bare"], cwd=str(main_repo), check=True, capture_output=True) + clone = tmp_path / "clone" + subprocess.run( + ["git", "clone", str(main_repo), str(clone)], + check=True, capture_output=True, + ) + subprocess.run(["git", "config", "user.email", "test@test"], cwd=str(clone), check=True) + subprocess.run(["git", "config", "user.name", "Test"], cwd=str(clone), check=True) + (clone / "README.md").write_text("test\n") + subprocess.run(["git", "add", "README.md"], cwd=str(clone), check=True) + subprocess.run(["git", "commit", "-m", "init"], cwd=str(clone), check=True) + subprocess.run(["git", "push", "origin", "HEAD:main"], cwd=str(clone), check=True) + result = subprocess.run( + [ + "uv", "run", "python", "-m", "scripts.tier2.run_track", + "smoke_track", "--repo-path", str(clone), + ], + capture_output=True, text=True, timeout=60, + ) + assert result.returncode == 0, f"run_track failed: rc={result.returncode}\nstdout={result.stdout}\nstderr={result.stderr}" + branch_result = subprocess.run( + ["git", "branch"], + cwd=str(clone), capture_output=True, text=True, + ) + assert "tier2/smoke_track" in branch_result.stdout