test(test-server): cover serve flags, cache policies, and discovery etag#746
Conversation
Add tests for HTTP-level branches that the spec-accessor tests did not exercise: - `serve_discovery = false` and `serve_jwks = false` return 404. - `CachePolicySpec::no_store` emits `Cache-Control: no-store` with no ETag. - `emit_etag = false` sets only `Cache-Control`, never `ETag`. - Discovery emits a body-derived ETag when caching is enabled (the `unwrap_or_else` fallback in `cached_json_response`). - JWKS revalidation with a non-matching `If-None-Match` returns 200 + ETag.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Summary
Adds HTTP-level coverage for
uselesskey-test-serverbranches that the existing spec-accessor tests do not exercise.New tests in
tests/serve_flags_and_cache.rs:serve_discovery = falsereturns404on the discovery endpoint while JWKS still servesserve_jwks = falsereturns404on the JWKS endpoint while discovery still servesfalsetogether produce 404 on both endpointsCachePolicySpec::no_storeemitsCache-Control: no-storeand no ETagemit_etag = falsewithmax_age_seconds > 0sets onlyCache-Control, neverETagunwrap_or_elseetag fallback incached_json_response, which the JWKS endpoint never hits because it always carries a phase)If-None-Matchreturns200plus the freshETag, distinguishing the mismatch branch from the304pathTest plan
cargo test -p uselesskey-test-server --test serve_flags_and_cache— all 7 tests passcargo clippy -p uselesskey-test-server --tests --all-features— cleancargo fmt --checkGenerated by Claude Code