* test(e2e): share the CLI version rule, env lockdown and rate limiter in tests/e2e/cli_harness Moves the npm release rule (now taking the package name), the env allowlist plus fresh HOME, and the per-upstream rate limiter out of claude_code so the Codex suite can reuse them. Claude Code behavior is unchanged, its CI, cron and Dockerfile paths now call the shared resolver with @anthropic-ai/claude-code * test(e2e): freeze the packument map and note the rate limiter self-test * test(e2e): race real processes on one rate limiter bucket so a missing lock fails Eight spawned processes start together and drain a bucket that never refills. With the flock they get exactly its burst between them, without it every attempt is granted * test(e2e): keep the old Claude Code version resolver path for the Buildkite runner images The runner Dockerfiles still run tests/e2e/claude_code/pr_gate_version_resolver.py and silently install @latest when it is missing, which drops the three day review window. The old path now forwards to cli_harness/npm_version_resolver.py
2.4 KiB
e2e harness tests
Tests of the harness under tests/e2e/ (the transport, the clients, the fixture bundle and replay edge, the stack lock, the IdP launcher, the coverage collector, the JUnit properties and the Claude Code driver), not of the product. They live outside tests/e2e/ because the Buildkite e2e run copies that folder into the runner image and runs every test in it, so a harness test in there counts as a product test in the nightly numbers. Nothing here needs a proxy, provider keys or the network
The layout mirrors tests/e2e/: test_e2e_http.py covers tests/e2e/e2e_http.py, logging/test_datadog_reader.py covers tests/e2e/logging/datadog_reader.py, claude_code/ covers the driver, builder and probe, and cli_harness/ covers the version resolver, the CLI env lockdown and the rate limiter. Put a new harness test under the folder that mirrors the suite folder whose module it covers
Run them from the repo root. e2e_config reads LITELLM_MASTER_KEY at import and any value will do, the CI lane sets a dummy:
LITELLM_MASTER_KEY=sk-harness uv run pytest tests/e2e_harness
pytest.ini here puts tests/e2e and the suite folders whose modules are under test on the path, so imports look exactly as they do inside the suite (from e2e_http import ..., from batch_cleanup import ...). claude_code/test_request_determinism.py drives the real claude CLI. Deselect it with -m "not cli_determinism" when the CLI is not installed
Rules: no e2e marker and no @meta, since nothing here drives the proxy. @pytest.mark.covers only where the test proves the collector or the JUnit properties read it. Inputs via arguments or env vars (setting an env var through pytest's monkeypatch fixture is fine, patching a function, class or module is not). And the same typing bar as the suite, make lint-e2e-basedpyright covers this folder and allows zero errors. The raw HTTP client ban (tests/code_coverage_tests/check_e2e_no_raw_requests.py) applies here too
CI: the python job in .github/workflows/test-linting.yml runs this folder whenever anything under tests/e2e/ (except ui/) or tests/e2e_harness/ changes, with the claude CLI installed. It also runs tests/code_coverage_tests/test_provider_replay_harness.py and tests/code_coverage_tests/test_provider_cache.py with --noconftest -o addopts= -o "pythonpath=tests/e2e tests/e2e_harness" -p no:rerunfailures; the replay test imports helpers from test_provider_edge.py