Repository navigation
test(mcpserver): wait for the server before rotating its certificate - #921
Open
polylane[bot] wants to merge 1 commit into
Open
polylane[bot] wants to merge 1 commit into
polylane[bot] wants to merge 1 commit into
Conversation
Co-authored-by: polylane[bot] <277585245+polylane[bot]@users.noreply.github.com>
ecv
approved these changes
Nov 18, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
The helper now waits for a 200 from /healthz before any test can rewrite the certificate files, and fails fast if serve returns first, which closes the startup race behind "failed to find any PEM data". The assertions on which certificate is served are unchanged.
scotwells
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The required CI check on the default branch failed on a test that starts the MCP server and replaces its certificate at the same time. The test replaced the certificate before the server finished loading the first one, so the server exited at startup and nothing answered, and the run waited 20 seconds before it failed. The test helper now waits until the server answers before any test can rotate the certificate. The failing run reported "loading serving certificate: tls: failed to find any PEM data in certificate input", a startup error that only the certificate load produces, and 2 of 40 runs failed on the unmodified tree. Waiting for a successful health response removes the window, and the assertions about which certificate is served stay the same.
Production impact at
e3791a0: Test helper waits for the MCP server before rotationFix walkthrough
Watch the fix explained (1:26). Recorded for commit
e3791a0f775e8755c3fd23eadb4c489dcff1087d.Full analysis
sequenceDiagram participant T as Test participant S as serve goroutine participant F as tls.crt on disk T->>S: start serving Note over T,S: before: the helper returned here T->>F: truncate and write cert 2 S->>F: certwatcher reads the files F-->>S: empty PEM S-->>T: loading serving certificate error Note over T,S: after: the helper waits for a 200 from /healthz, then the test rotatesProduction impact
The change edits one Go test file,
internal/mcpserver/tls_test.go. A_test.gofile is excluded from the manager and extension-server builds, and the repository graph lists no deploy target for this repository, so no deployed resource changes behavior on merge. I checked the certificate load path ininternal/mcpserver/server.goand the watcher poll interval of 10s against the test's 20s rotation window.Checked and not affected (1)
network-services-operatorObservability
make test-suiteas the required checkPolylane assessed this pull request at
e3791a0.Causal chain
1 file changed (+47/-6)
internal/mcpserver/tls_test.go: modified, +47/-6Generated by Polylane. You can ask follow-ups by mentioning @polylane in a comment. If you close this pull request without merging, add a comment that says why. Polylane reads it to make its next fixes better.