fix: make e2e tests pass reliably locally with Docker Desktop#13741
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves local reliability of the Go E2E test suite (especially on Docker Desktop) by reducing stale resource reuse between runs, adding readiness/cleanup polling, and adjusting a few tests to be more deterministic across environments.
Changes:
- Increase polling timeouts and add explicit readiness checks to avoid flakiness on slower Docker Desktop startups.
- Make teardown more reliable (e.g.,
t.Cleanup, explicitdown, and polling for async--rmremoval). - Re-enable previously skipped E2E tests and adjust test commands/project naming to avoid mismatches and reuse.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/safebuffer.go | Increase RequireEventuallyContains poll timeout to accommodate Docker Desktop startup latency. |
| pkg/e2e/watch_test.go | Ensure watched services are built and add explicit poll timeouts for watch/rebuild waits. |
| pkg/e2e/publish_test.go | Add registry readiness polling prior to publish operations. |
| pkg/e2e/ps_test.go | Add pre-test cleanup to avoid stale state from prior failed runs. |
| pkg/e2e/pause_test.go | Re-enable the pause E2E test by removing the CI skip. |
| pkg/e2e/networks_test.go | Re-enable TestNetworkConfigChanged. |
| pkg/e2e/model_test.go | Conditionally skip based on docker-model plugin availability; align project usage and ensure --rm. |
| pkg/e2e/env_file_test.go | Fix project name consistency and ensure run uses --rm and explicit -p. |
| pkg/e2e/compose_test.go | Use t.Cleanup for teardown to improve reliability. |
| pkg/e2e/compose_run_test.go | Poll for async container auto-removal after --rm to avoid timing flakes. |
| pkg/e2e/compose_run_build_once_test.go | Use t.Cleanup-based teardown and avoid pre-run cleanup with random project names. |
| pkg/e2e/build_test.go | Skip the “docker driver lacks multi-arch support” assertion when buildx reports multi-platform support under the docker driver. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Wait for registry to be ready | ||
| registryURL := "http://" + registry + "/v2/" | ||
| poll.WaitOn(t, func(l poll.LogT) poll.Result { | ||
| resp, err := http.Get(registryURL) //nolint:gosec,noctx | ||
| if err != nil { | ||
| return poll.Continue("registry not ready: %v", err) | ||
| } | ||
| _ = resp.Body.Close() | ||
| if resp.StatusCode < 500 { | ||
| return poll.Success() | ||
| } | ||
| return poll.Continue("registry not ready, status %d", resp.StatusCode) | ||
| }, poll.WithTimeout(10*time.Second), poll.WithDelay(100*time.Millisecond)) |
There was a problem hiding this comment.
The registry readiness poll uses http.Get without any request timeout. If the TCP connection succeeds but the server never responds (or a proxy/network issue stalls reads), this can hang indefinitely and bypass the poll timeout. Use a http.Client with a short Timeout or use the existing HTTPGetWithRetry helper (pkg/e2e/framework.go) so each attempt is bounded by a per-request timeout and the overall poll timeout remains effective.
78d3c05 to
bdfa361
Compare
|
/review |
|
❌ PR Review Failed — The review agent encountered an error and could not complete the review. View logs. |
- Fix stale image/container reuse across test runs - Add registry readiness check and async removal polling - Skip multi-arch test when docker driver supports it - Use t.Cleanup for reliable teardown, fix project name mismatches - Re-enable 4 previously skipped tests that now pass Signed-off-by: Guillaume Lours <[email protected]>
bdfa361 to
69c3a39
Compare
|
/review |
|
❌ PR Review Failed — The review agent encountered an error and could not complete the review. View logs. |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [docker/compose](https://github.com/docker/compose) | patch | `v5.1.3` → `v5.1.4` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>docker/compose (docker/compose)</summary> ### [`v5.1.4`](https://github.com/docker/compose/releases/tag/v5.1.4) [Compare Source](docker/compose@v5.1.3...v5.1.4) #### What's Changed ##### ✨ Improvements - feat: add stop lifecycle hook for external providers by [@​glours](https://github.com/glours) in [#​13779](docker/compose#13779) ##### 🐛 Fixes - fix: route OCI artifact pulls through Docker Desktop HTTP proxy by [@​glours](https://github.com/glours) in [#​13770](docker/compose#13770) - fix: restore stoppingEvent/stoppedEvent helpers for plugin stop hook by [@​glours](https://github.com/glours) in [#​13794](docker/compose#13794) - fix(publish): flag literal inline environment values by [@​glours](https://github.com/glours) in [#​13760](docker/compose#13760) ##### 🔧 Internal - ci: remove unused e2e job from merge workflow by [@​glours](https://github.com/glours) in [#​13740](docker/compose#13740) - chore: update cagent-action to `v1.4.4` by [@​derekmisler](https://github.com/derekmisler) in [#​13745](docker/compose#13745) - Change verb tense in Docker Compose reference documentation by [@​ryanjbonnell](https://github.com/ryanjbonnell) in [#​13773](docker/compose#13773) - pkg/compose: go fix by [@​thaJeztah](https://github.com/thaJeztah) in [#​13782](docker/compose#13782) - refactor: code deduplication and simplification by [@​ndeloof](https://github.com/ndeloof) in [#​13759](docker/compose#13759) - fix: make e2e tests pass reliably locally with Docker Desktop by [@​glours](https://github.com/glours) in [#​13741](docker/compose#13741) - refactor: drop Desktop beta-settings check; gate hint on LogsTab flag by [@​glours](https://github.com/glours) in [#​13755](docker/compose#13755) ##### ⚙️ Dependencies - build(deps): bump github.com/mattn/go-shellwords from `1.0.12` to `1.0.13` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13731](docker/compose#13731) - build(deps): bump github.com/docker/cli from `29.4.0+incompatible` to `29.4.2+incompatible` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13768](docker/compose#13768) - build(deps): bump github.com/moby/moby/client from `0.4.0` to `0.4.1` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13752](docker/compose#13752) - build(deps): bump github.com/docker/cli from `29.4.2+incompatible` to `29.4.3+incompatible` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13776](docker/compose#13776) - build(deps): bump google.golang.org/grpc from `1.80.0` to `1.81.0` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13775](docker/compose#13775) - build(deps): update to `go 1.26.3` by [@​thaJeztah](https://github.com/thaJeztah) in [#​13783](docker/compose#13783) - build(deps): bump google.golang.org/grpc from `1.81.0` to `1.81.1` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13791](docker/compose#13791) - build(deps): bump github.com/compose-spec/compose-go/v2 from `2.10.2` to `2.11.0` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13798](docker/compose#13798) - build(deps): bump github.com/docker/cli from `29.4.3+incompatible` to `29.5.1+incompatible` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13796](docker/compose#13796) - build(deps): bump golang.org/x/sys from `0.42.0` to `0.44.0` by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13788](docker/compose#13788) #### New Contributors - [@​ryanjbonnell](https://github.com/ryanjbonnell) made their first contribution in [#​13773](docker/compose#13773) **Full Changelog**: <docker/compose@v5.1.3...v5.1.4> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODYuNCIsInVwZGF0ZWRJblZlciI6IjQzLjE4Ni40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
What I did
Related issue
N/A
(not mandatory) A picture of a cute animal, if possible in relation to what you did