test(e2e): freeze the packument map and note the rate limiter self-test

This commit is contained in:
ryan-crabbe-berri 2026-10-30 18:30:20 -07:00
parent 7f83ad7028
commit 3185f73572
3 changed files with 6 additions and 4 deletions

View file

@ -22,7 +22,7 @@ import tempfile
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union
from typing import Any, Callable, Dict, Final, List, Mapping, Optional, Sequence, Tuple, Union
from cli_harness.lockdown import isolated_home, locked_down_env
from cli_harness.rate_limiter import RateBucket, RateLimiter, get_default_limiter
@ -72,6 +72,7 @@ Anthropic / Bedrock / Vertex) to reset. Both knobs are env-tunable so
a matrix run can trade wall time for resilience without code edits;
retries=0 disables the behavior entirely."""
def infer_provider(model: str) -> RateBucket:
"""Map a model alias to its compat-matrix rate bucket.
@ -85,7 +86,7 @@ def infer_provider(model: str) -> RateBucket:
"""
if not model:
raise ValueError("model must be a non-empty string")
lower = model.lower()
lower: Final = model.lower()
if lower.endswith("-azure-openai"):
return RateBucket.AZURE_OPENAI
if lower.endswith("-openai"):

View file

@ -16,6 +16,7 @@ import urllib.request
from collections.abc import Mapping
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from types import MappingProxyType
from typing import BinaryIO, Final, cast
MIN_AGE: Final = timedelta(days=3)
@ -33,7 +34,7 @@ class Packument:
document: Final = _as_mapping(raw)
times: Final = _as_mapping(document.get("time"))
return cls(
published_at={version: _parse_utc(stamp) for version, stamp in _string_values(times)},
published_at=MappingProxyType({version: _parse_utc(stamp) for version, stamp in _string_values(times)}),
versions=frozenset(_as_mapping(document.get("versions"))),
)

View file

@ -2,7 +2,7 @@
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 and the CLI env lockdown. Put a new harness test under the folder that mirrors the suite folder whose module it covers
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: