Repository navigation
test(macos-docker-desktop): skip tests hitting a Docker Desktop connection reset - #8627
Merged
Merged
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
rfay
force-pushed
the
20260729_rfay_macos_dd_retry
branch
from
July 29, 2026 22:01
aa04bcd to
7eee72c
Compare
Member
Author
|
I think I'll add TestHardenedStart |
…TP checks getLocalHTTPResponse already gave a single-shot request one extra try on macOS for a brief php-fpm SIGBUS 502/503, but not for a TCP-level connection reset/refusal - the failure mode seen when Docker Desktop's port forwarding hasn't fully caught up right after a container reports healthy (see docker/for-mac#5407). Broaden the existing retry floor from "5xx status" to "any request error" so it also covers that case. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011hMVwyxzg1d9iYJq3hDKNX
…tead of retrying Buildkite log analysis (ddev/ddev-macos-arm64-mutagen, last ~300 builds) found 8 test functions across 4 files intermittently hit connection reset by peer right after container start, all on Docker Desktop/Apple Silicon - the port-forwarding race in docker/for-mac#5407. Revert the prior retry- based fix (only covered one of the eight) and instead skip each affected test on Docker Desktop/Apple Silicon, consistent with the existing skip pattern for this class of failure, with DDEV_RUN_TEST_ANYWAY as the escape hatch. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011hMVwyxzg1d9iYJq3hDKNX
…t right after start The prior commit (7eee72c) covered 8 test functions found by mining Buildkite history. Auditing every test that calls a local-HTTP-check helper immediately after app.Start()/Restart()/StartAndWait() turned up 13 more with the identical shape - a single-attempt HTTP request against a container's forwarded port right after it reports healthy, vulnerable to the same Docker Desktop/Apple Silicon port-forwarding race (docker/for-mac#5407). Skip them the same way, with DDEV_RUN_TEST_ANYWAY as the escape hatch. Notably TestTraefikSimple - the test from the original failing log - never actually got the fix in the prior commit; only TestTraefikVirtualHost and TestCustomProjectTraefikConfig in that file did. Co-Authored-By: Claude Sonnet 5 <[email protected]>
rfay
force-pushed
the
20260729_rfay_macos_dd_retry
branch
from
July 30, 2026 15:25
78f95c1 to
a38d97f
Compare
Member
Author
|
I added a few more. I think we overall have totally adequate test coverage, including macOS, so don't think this has a lot of risk. |
rfay
added a commit
to rfay/ddev
that referenced
this pull request
Oct 30, 2026
…after alias updates ## Short Summary (TL;DR) After DDEV reconnects `ddev-router` to update its aliases, Docker Desktop on macOS can forward a router port to a stale target, so requests get `connection reset by peer`. DDEV now warns about it, and `TestGetWebContainerDirectURLsWithGenericWebserver` logs better diagnostics and tolerates the delay on Docker Desktop. ## The Issue `TestGetWebContainerDirectURLsWithGenericWebserver` failed 15 times on `ddev-macos-arm64-mutagen` since 2026-10-08, counting retried jobs. That is about 7% of test jobs. Every failure came right after `Updating router network aliases in place`. Traefik had the route, but `127.0.0.1:443` or `:80` reset the connection and was still resetting 5s later. The reset is a long-standing Docker Desktop problem. ddev#8627 skipped about 18 tests for it. This test started requesting router URLs in ddev#8903, after that skip. `warnUnreachableRouterPorts` could not see it: it only looked for refused connections, and it only ran when the router was recreated. ## How This PR Solves The Issue - `netutil.IsPortUnreachable` (formerly `IsPortRefused`) sends a minimal HTTP request. A refused connection, or one that closes or resets before any response, counts as unreachable. - `warnUnreachableRouterPorts` also runs after the in-place alias update. - `logRouterDiagnostics` logs the router's published ports and curls the URL from containers on `ddev_default` and the host network. It then polls the URL for up to 60s and logs how long recovery takes. - On Docker Desktop, the test passes when the URL recovers within that time. Otherwise it fails as before. ## Manual Testing Instructions ```bash ddev utility download-ddev --pr 9026 export PATH="$HOME/tmp/ddev-download-ddev/pr-9026:$PATH" ddev start # in a first project ddev start # in a second project with a new hostname # Expect no "nothing answers on host port(s)" warning on a healthy provider ``` ## Automated Testing Overview `TestIsPortUnreachable` covers answering, refused, reset, and closed-without-answer listeners. In the Docker Desktop CI logs, look for `recovered after Ns` from `logRouterDiagnostics`. It shows whether polling is enough here and in `TestCmdLogs`, or whether these tests need the ddev#8627 skip. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 Issue
ddev-macos-arm64-mutagenpipeline), not tied to a single tracked issue number.Several tests intermittently fail on macOS/arm64/Docker Desktop CI with a TCP-level connection reset rather than a bad HTTP response, e.g.:
This happens immediately after the containers/router report healthy. It's a documented, still-unresolved class of bug in Docker Desktop for Mac's networking layer, where forwarded ports intermittently reset or refuse the first connection right after a container reports healthy, because the container's internal healthcheck can pass before the host-side port-forwarding path has fully caught up:
This is the same symptom already worked around elsewhere in this codebase (
TestPHPOverrides,TestHttpsRedirection,TestInternalAndExternalAccessToURL, all of which skip on Apple Silicon/Lima/Colima/Rancher), but a broader analysis of ~300 recentddev-macos-arm64-mutagenbuilds (via the Buildkite REST API) turned up 8 test functions across 4 files that hit this same reset and aren't guarded:TestTraefikVirtualHost,TestCustomProjectTraefikConfig(pkg/ddevapp/traefik_test.go)TestPHPConfig(pkg/ddevapp/config_test.go)TestDdevFullSiteSetup,TestDdevStartMultipleHostnames(pkg/ddevapp/ddevapp_test.go)TestDdevXhprofPrependEnabled,TestDdevXhprofXhguiEnabled(pkg/ddevapp/xhprof_xhgui_test.go)TestCmdXHGui(cmd/ddev/cmd/xhgui_test.go)An earlier version of this PR broadened
pkg/testcommon/http.go's existing macOS retry floor to cover connection-reset errors, not just 5xx statuses, but that only coveredTestTraefikVirtualHost(the one test using that retry helper) and added retry complexity to product test infrastructure for what's a single-platform CI flake. Given how many distinct tests hit this and that it's Docker Desktop/Apple Silicon-specific, a skip is the simpler, more consistent fix.How This PR Solves The Issue
Reverts the retry-floor broadening in
pkg/testcommon/http.goback to its original 5xx-only behavior, and instead adds a skip guard to each of the 8 affected tests, consistent with the existing skip pattern used byTestPHPOverrides/TestHttpsRedirection/TestInternalAndExternalAccessToURL:Scoped to Docker Desktop + Apple Silicon specifically (rather than all Apple Silicon runtimes, which also covers Colima/Lima/Rancher where this hasn't been observed), with
DDEV_RUN_TEST_ANYWAY=trueas the existing escape hatch to force these tests to run anyway.Manual Testing Instructions
go test -v -run TestTraefikVirtualHost ./pkg/ddevapp/— it should skip with a message referencingDDEV_RUN_TEST_ANYWAY.DDEV_RUN_TEST_ANYWAY=true go test -v -run TestTraefikVirtualHost ./pkg/ddevapp/to confirm it still executes normally.Automated Testing Overview
No new automated tests: this is a CI-flake mitigation, not new product behavior. Existing coverage for these 8 tests is unchanged on every platform except Docker Desktop/Apple Silicon, where they now skip instead of intermittently failing.
Release/Deployment Notes
Test-only change (
pkg/testcommon,pkg/ddevapp,cmd/ddev/cmdtest files), no impact on shippedddevbehavior. Reduces flakiness of macOS Docker Desktop CI/nightly runs at the cost of not running these 8 tests on that platform combination (they still run everywhere else, and can be forced withDDEV_RUN_TEST_ANYWAY=true).