Conversation
openmetadata-mcp declared com.squareup.okhttp3:mockwebserver for exactly one test class, which used it to serve a static JWKS document. The JDK's com.sun.net.httpserver.HttpServer does that in a few lines, so the dependency is removed and no source in the module references it any more. This also removes a latent trap. MockWebServer.enqueue is a one-shot queue: each enqueued response is consumed by one request, and the test enqueued one response in setUp plus another inside the no-audience case. Any change causing an extra JWKS fetch - a retry, a cache miss, a second validator - would have drawn from an empty queue and failed as a JWKS parse error rather than a missing stub. The HttpServer handler serves the same body to every request, so the test no longer depends on how many times the validator fetches. All 10 tests in IdTokenValidatorTest pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ ApprovedReplaces OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
✅ Playwright Results — workflow succeededValidated commit ✅ 4477 passed · ❌ 0 failed · 🟡 4 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 34m 41s ⏱️ Max setup 5m 18s · max shard execution 21m 5s · max shard-job elapsed before upload 25m 12s · reporting 18s 🌐 219.60 requests/attempt · 2.23 app boots/UI scenario · 39.37% common-shard skew Optimization targets still in progress:
🟡 4 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Describe your changes:
Fixes #33545. Salvaged from the closed PR #33248 (tracking: #33528).
openmetadata-mcpdeclaredcom.squareup.okhttp3:mockwebserver:4.12.0for exactly one test class,which used it to serve a static JWKS document. The JDK's
com.sun.net.httpserver.HttpServerdoesthat in a few lines, so the dependency is removed — no source in the module references it any more.
This also removes a latent trap.
MockWebServer.enqueueis a one-shot queue: each enqueuedresponse is consumed by a single request. The test enqueued one JWKS response in
setUpand a secondinside
testValidateAndDecode_NoAudienceValidationWhenNull. Any change causing an extra JWKS fetch —a retry, a cache miss, a second validator instance — would have drawn from an empty queue and failed
as a JWKS parse error rather than an obviously missing stub. The
HttpServerhandler serves thesame body to every request, so the test no longer depends on how many times the validator fetches.
Type of change:
High-level design:
The server binds
127.0.0.1:0(ephemeral port, read back viagetAddress().getPort()), registers asingle
/jwkscontext that writes the pre-encoded body, and is stopped in@AfterEach. No behaviourunder test changes — only how the JWKS endpoint is stood up.
Tests:
Use cases covered
unknown key id, and the no-audience-validation path.
Unit tests
No new tests. All 10 existing tests in
IdTokenValidatorTestpass unchanged:Backend integration tests
Not applicable — no API change.
Ingestion integration tests
Not applicable.
Playwright (UI) tests
Not applicable.
Manual testing performed
mvn -pl openmetadata-mcp test -Dtest=IdTokenValidatorTest— 10 tests, BUILD SUCCESS.grep -rn 'mockwebserver\|MockWebServer' openmetadata-mcp/— no matches outsidetarget/.mvn spotless:apply -pl openmetadata-mcp— 136 files clean, 0 changed.are changed by this diff.
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #33545.🤖 Generated with Claude Code
The PR appears safe to merge; the test-only server replacement preserves the JWKS fixture behavior while removing its one-response limitation.
Summary
Replaces the one-shot MockWebServer JWKS fixture with a reusable loopback JDK
HttpServerand removes the now-unused test dependency.Reviews (1) · Last reviewed commit: "Fixes 33545: serve JWKS from the JDK Htt..."