Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

ci: run the keyless caching tests that ran in no job (#37790)

yuneng-jiangb31484ed196d
diff --git a/.github/ci-coverage-allowlist.yml b/.github/ci-coverage-allowlist.yml
index 918589f84d1..b6ec08bd295 100644
--- a/.github/ci-coverage-allowlist.yml
+++ b/.github/ci-coverage-allowlist.yml
@@ -5,24 +5,21 @@ description: >-
test_paths:
- reason: >-
- The caching suite in tests/local_testing, which runs nowhere. Every job that globs that
- directory either deselects it (local_testing_part1 and part2 carry `-k "... and not caching
- and not cache"`) or keeps only another keyword (langfuse, router, assistants), and no job
- names these files the way redis_caching_unit_tests names test_dual_cache.py. Measured
- 2026-08-20 by collecting the directory under each job's own selector: 118 tests across
- these eight files are selected by none of them. Listed so the gap is a decision rather
- than an accident, and so the --slices guard has a baseline to ratchet down from. Revisit
- when tests/local_testing is ported off CircleCI, where the keyless part of this suite
- belongs in a real job
+ What is left of the caching suite in tests/local_testing that runs nowhere. Every job that
+ globs that directory either deselects it (local_testing_part1 and part2 carry `-k "... and
+ not caching and not cache"`) or keeps only another keyword (langfuse, router, assistants),
+ and no job names these files the way redis_caching_unit_tests names test_dual_cache.py.
+ The gap was eight files and 118 tests when measured 2026-08-20; the five keyless ones now
+ run in the caching-local shard, leaving these three. Measured 2026-08-21 with no provider
+ credentials and no Redis: test_caching.py needs both (37 of 65 fail without them),
+ test_disk_cache_unit_tests.py needs OPENAI_API_KEY for 2 of its 4, and
+ test_gcs_cache_unit_tests.py needs GCS credentials for all 4. They want the keyless/live
+ split that porting tests/local_testing off CircleCI will force, not a job that is red by
+ construction
paths:
- - tests/local_testing/test_cache_preset_key.py
- tests/local_testing/test_caching.py
- - tests/local_testing/test_caching_handler.py
- tests/local_testing/test_disk_cache_unit_tests.py
- tests/local_testing/test_gcs_cache_unit_tests.py
- - tests/local_testing/test_prompt_caching.py
- - tests/local_testing/test_responses_stream_cache_keys.py
- - tests/local_testing/test_unit_test_caching.py
- reason: >-
The end-to-end suite runs against a deployed proxy from its own in-cluster rig rather than
from a pull request; it needs a live gateway and provider credentials no PR job holds
diff --git a/.github/scripts/assert_ci_coverage.py b/.github/scripts/assert_ci_coverage.py
index c8572d9f6ef..411852acb98 100644
--- a/.github/scripts/assert_ci_coverage.py
+++ b/.github/scripts/assert_ci_coverage.py
@@ -312,8 +312,23 @@ def _matchable_names(relative_path: str) -> frozenset[str]:
)
+def _workflow_named_tokens() -> frozenset[str]:
+ """Test tokens a GitHub Actions job names directly.
+
+ A CircleCI `-k` that deselects a file no longer means the file runs nowhere once a
+ workflow names it, so the slice check has to credit those the same way the census does.
+ """
+ return _invoked_test_tokens(
+ scalar
+ for path in _config_files()
+ if path != CIRCLECI_CONFIG
+ for scalar in _scalars(yaml.safe_load(path.read_text(encoding="utf-8")), path.name)
+ )
+
+
def _deselected_everywhere(allowlist: Allowlist) -> tuple[Finding, ...]:
slices: Final = _slices()
+ named_by_workflow: Final = _workflow_named_tokens()
globbed: Final = tuple(
path
for path in _test_files()
@@ -326,6 +341,7 @@ def _deselected_everywhere(allowlist: Allowlist) -> tuple[Finding, ...]:
)
for path in globbed
if not allowlist.covers_test(path)
+ and not any(_token_covers(token, path) for token in named_by_workflow)
and not any(slice_.claims(path, _matchable_names(path)) for slice_ in slices)
)
diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml
index 71eb0958bec..5a75b4af7db 100644
--- a/.github/workflows/test-unit.yml
+++ b/.github/workflows/test-unit.yml
@@ -200,6 +200,19 @@ jobs:
timeout-minutes: 20
job-timeout-minutes: 60
+ - shard: caching-local
+ artifact-name: caching-local
+ test-path: >-
+ tests/local_testing/test_cache_preset_key.py
+ tests/local_testing/test_caching_handler.py
+ tests/local_testing/test_prompt_caching.py
+ tests/local_testing/test_responses_stream_cache_keys.py
+ tests/local_testing/test_unit_test_caching.py
+ workers: 2
+ reruns: 2
+ timeout-minutes: 20
+ job-timeout-minutes: 55
+
- shard: responses-caching-types
artifact-name: responses-caching-types
test-path: >-
diff --git a/tests/test_litellm/test_assert_ci_coverage.py b/tests/test_litellm/test_assert_ci_coverage.py
index 4c8f4cc2984..d948c1a4155 100644
--- a/tests/test_litellm/test_assert_ci_coverage.py
+++ b/tests/test_litellm/test_assert_ci_coverage.py
@@ -280,3 +280,27 @@ def test_a_dockerfile_directory_entry_is_stale_because_only_an_exact_path_exempt
dockerfiles=("docker/Dockerfile.database",),
)
assert [f.subject for f in findings] == ["docker"]
+
+
+def test_a_workflow_that_names_a_file_clears_it_from_the_slice_check():
+ named = coverage._workflow_named_tokens()
+ assert named, "the workflows must name some test paths or the check proves nothing"
+ assert any(
+ coverage._token_covers(token, "tests/local_testing/test_caching_handler.py")
+ for token in named
+ )
+
+
+def test_the_slice_check_credits_only_workflows_never_the_circleci_config():
+ named = coverage._workflow_named_tokens()
+ circleci_only = "tests/proxy_admin_ui_tests"
+ assert not any(coverage._token_covers(token, f"{circleci_only}/test_key_management.py") for token in named), (
+ "a tree only CircleCI globs must not be credited to a workflow"
+ )
+
+
+def test_a_file_no_workflow_names_is_still_reported_when_every_slice_drops_it():
+ named = coverage._workflow_named_tokens()
+ assert not any(
+ coverage._token_covers(token, "tests/local_testing/test_caching.py") for token in named
+ ), "test_caching.py is allowlisted, not run; crediting it would hide a real gap"