Skip to content

Commit 35abe8b

Browse files
committed
ci: isolate corrupt-cache reproduction from default test shards
The ``corrupt_cache_repro`` end-to-end test drives live conda-forge in two independent solves (corrupt-cache vs. clean-control) and runs ~2-5 minutes per parametrization. Putting it in the default unit-test collection would dominate every contributor's local pytest run and inflate every PR's CI wall clock for negligible additional confidence on most changes. Three pieces of CI plumbing: 1. ``pyproject.toml`` declares the ``corrupt_cache_repro`` marker and adds ``-m "not corrupt_cache_repro"`` to the default ``addopts``. ``pytest`` invocations from contributors, editors, and the unit-test CI shards exclude the e2e by default. Local opt-in is ``pytest -m corrupt_cache_repro``; bypass-everything is ``pytest -m ""``. 2. ``.github/workflows/test.yml`` adds a dedicated ``run-corrupt-cache-repro`` step that runs once per ``(os, py-version)`` on shard 1 / linux-64 only -- the fixture is a linux-64 cache snapshot from the PR conda#862 harness, so other platforms have nothing to test against. The step uses ``-o "addopts=-rsx --verbose"`` to clear the project-default exclusion and ``-m corrupt_cache_repro`` to opt back into just the e2e parametrizations. 3. The CI step targets ``tests/e2e/test_corrupt_repodata_repro.py`` directly so a future test author who marks an unrelated test with ``corrupt_cache_repro`` doesn't accidentally end up in the heavy CI lane. Behavior of the unit + component tests is unchanged. Verification: the new shard appears in the workflow matrix; the default shards now deselect the marker via `-m 'not corrupt_cache_repro'`. Confirm the partition is total by checking that both invocations together select every test: `pytest --collect-only -q -m corrupt_cache_repro` plus the inverse should sum to `pytest --collect-only -q`.
1 parent 89a606c commit 35abe8b

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ jobs:
142142
mkdir -p tests/durations
143143
set -x
144144
which pytest
145+
# Default `addopts` in pyproject.toml deselects the heavy
146+
# live-conda-forge corrupt-cache reproduction (see the
147+
# `corrupt_cache_repro` marker). The split unit-test job
148+
# honours that exclusion; the dedicated step below opts back
149+
# in and runs the e2e parametrizations on shard 1 only.
145150
pytest \
146151
--cov=conda_lock --cov-branch --cov-report=xml --cov-report=term \
147152
--store-durations \
@@ -151,6 +156,23 @@ jobs:
151156
--splits="${{ matrix.pytest-split-group-size }}" \
152157
--group="${{ matrix.pytest-split-group-index }}"
153158
159+
- name: run-corrupt-cache-repro
160+
# Live conda-forge driven; ~5 min each parametrization. Run
161+
# once per (os, python-version) on the first shard to keep
162+
# total wall-clock down without losing coverage. Linux only --
163+
# the fixture is a linux-64 cache snapshot from the PR #862
164+
# harness.
165+
if: matrix.pytest-split-group-index == 1 && matrix.os == 'ubuntu-latest'
166+
run: |
167+
set -x
168+
# `-o "addopts="` clears the project-default `-m "not
169+
# corrupt_cache_repro"`; then `-m corrupt_cache_repro` selects
170+
# only the e2e parametrizations.
171+
pytest \
172+
-o "addopts=-rsx --verbose" \
173+
-m corrupt_cache_repro \
174+
tests/e2e/test_corrupt_repodata_repro.py
175+
154176
- uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
155177
with:
156178
token: ${{ secrets.CODECOV_TOKEN }}

pyproject.toml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,27 @@ addopts = [
142142
"--doctest-modules",
143143
"--numprocesses=auto",
144144
"--ignore-glob=**/vendor_poetry/**",
145-
"--ignore-glob=**/_vendor/**"
145+
"--ignore-glob=**/_vendor/**",
146+
# Heavy live-conda-forge reproduction test for conda/conda-lock#896
147+
# is excluded from the default unit-test collection. CI's e2e job
148+
# opts back in with `-m "corrupt_cache_repro"` (overrides this `-m`).
149+
# Local invocation: `pytest -m corrupt_cache_repro` to run only
150+
# those tests, or `pytest -m ""` to bypass the filter entirely.
151+
"-m",
152+
"not corrupt_cache_repro",
146153
]
147154
log_level = "DEBUG"
148155
testpaths = ["tests", "conda_lock"]
156+
markers = [
157+
# Heavy conda-forge-driven reproduction test for conda/conda-lock#896.
158+
# Each parametrization runs ~2-5 minutes (real `conda-lock lock`
159+
# against a hybrid cache, then `conda-lock render --kind=explicit`)
160+
# and depends on live conda-forge state in TWO independent solves
161+
# (corrupt-cache vs clean-control). Excluded from default unit
162+
# collection via the `-m "not corrupt_cache_repro"` in `addopts`
163+
# above; CI runs this marker in a dedicated e2e step.
164+
"corrupt_cache_repro: heavy conda-forge-driven reproduction test for #896",
165+
]
149166

150167
[tool.vendoring]
151168
destination = "conda_lock/_vendor"

0 commit comments

Comments
 (0)