-
Notifications
You must be signed in to change notification settings - Fork 176
Refactor test-integration.sh to fixture-driven pytest discovery (eliminate manual test wiring) #1166
Copy link
Copy link
Open
Labels
area/ci-cdGitHub workflows, merge queue, gh-aw integrations, release pipeline.GitHub workflows, merge queue, gh-aw integrations, release pipeline.area/testingTest infrastructure, fixtures, e2e harness, coverage.Test infrastructure, fixtures, e2e harness, coverage.enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.priority/lowAccepted but not time-sensitiveAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).tech-debttestingDeprecated: use area/testing. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use area/testing. Kept for issue history; will be removed in milestone 0.10.0.type/refactorInternal restructure, no behavior change.Internal restructure, no behavior change.
Metadata
Metadata
Assignees
Labels
area/ci-cdGitHub workflows, merge queue, gh-aw integrations, release pipeline.GitHub workflows, merge queue, gh-aw integrations, release pipeline.area/testingTest infrastructure, fixtures, e2e harness, coverage.Test infrastructure, fixtures, e2e harness, coverage.enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.priority/lowAccepted but not time-sensitiveAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).tech-debttestingDeprecated: use area/testing. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use area/testing. Kept for issue history; will be removed in milestone 0.10.0.type/refactorInternal restructure, no behavior change.Internal restructure, no behavior change.
Type
Projects
Status
Todo
Problem
scripts/test-integration.shis a 665-line bash script that explicitly enumerates ~20pytest tests/integration/test_*.pyinvocations, one per file. Adding a new integration test file requires editing the script. Forgetting to wire a file means the test silently never runs.This is not a hypothetical risk -- it just bit us:
tests/integration/test_skill_install.pywas never wired into the script. Two existing tests (test_reinstall_same_skill_is_idempotent, and the newtest_reinstall_does_not_leak_apm_pin_to_deploy_targetsfrom PR fix: exclude .apm-pin from skill deploy copytree #1153) silently rotted until I noticed and patched it in PR fix: exclude .apm-pin from skill deploy copytree #1153 (commit941c6942)..github/workflows/ci-integration.ymlonly invokestest_runtime_smoke.py; the other ~19 files run only on manual release-validation execution. Most "integration coverage" runs on the honor system.Real constraints (what's legitimate)
The script does several things that genuinely need orchestration:
./dist/$BINARY_NAME/apm)$PATHso tests exercise the shipped binary, not in-processpython -m apm_cliapm runtime setupgithub-token-helper.shThese are real concerns. Per-file pytest enumeration is not.
What's wrong (per Python testing world-class standards)
pytest <dir>finds and runs everything matchingtest_*.py). The bash script defeats that.if pytest ... ; then log_success ; else log_error ; exit 1 ; fiblocks reimplement what pytest does natively, and worse: a single test file failure aborts the whole run viaset -e, masking subsequent failures.ADO_APM_PAT,GITHUB_APM_PAT,APM_RUN_INTEGRATION_TESTS=1, runtime presence). Today this is encoded as conditional bash branches; it should be@pytest.mark.requires_ado_patetc., selectable viapytest -m.session-scoped fixture, not a loop.Proposed pattern
scripts/test-integration.shshrinks to ~50 lines: detect platform, build/locate binary, set up runtimes, export tokens, then one invocation:pytest tests/integration/ -v --tb=short \ $( [[ -z "${ADO_APM_PAT:-}" ]] && echo '-m "not requires_ado_pat"' )Pytest handles discovery, selection, reporting, exit codes. Bash handles env setup. Each layer does what it's good at.
Acceptance criteria
scripts/test-integration.shno longer enumerates individualpytest test_*.pycalls; it invokespytest tests/integration/with marker selection.tests/integration/with the right markers automatically runs without script edits..github/workflows/ci-integration.yml) optionally extended to run the full marker-filtered suite (currently only runs smoke).Out of scope
github-token-helper.shor runtime-setup commands.References
941c6942)scripts/test-integration.sh:336-664(the enumerated pytest blocks)