Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Caddy integration tests to reduce macOS flakiness by ensuring the test server is actually accepting connections after InitServer, addressing transient SO_REUSEPORT routing to a shutting-down listener.
Changes:
- Introduce an
initServerhelper that callstester.InitServerand then polls the HTTP endpoint to avoid early “connection reset by peer” failures. - Replace direct
tester.InitServer(...)calls throughout the file withinitServer(...). - Remove now-redundant
waitForServerReady(...)calls in tests that previously needed extra readiness polling.
Comments suppressed due to low confidence (1)
caddy/caddy_test.go:43
initServerreturns silently if all 10 polling attempts fail, so tests may continue with the server still unavailable and fail later with less actionable errors. Consider failing the test after the retry loop (e.g.,t.Fatalf/require.FailNow) and include the last error/URL in the message so readiness issues are surfaced immediately.
url := "http://localhost:" + testPort
client := &http.Client{Timeout: 1 * time.Second}
for range 10 {
resp, err := client.Get(url)
if err == nil {
require.NoError(t, resp.Body.Close())
return
}
time.Sleep(100 * time.Millisecond)
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alexandre-daubois
approved these changes
Mar 6, 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.
No description provided.