Skip to content

Fix flakiness, race conditions, and timeout in DinD image tests#13739

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test/cl949451402
Jul 17, 2026
Merged

Fix flakiness, race conditions, and timeout in DinD image tests#13739
copybara-service[bot] merged 1 commit into
masterfrom
test/cl949451402

Conversation

@copybara-service

Copy link
Copy Markdown

Fix flakiness, race conditions, and timeout in DinD image tests

Previously, DinD image tests suffered from several stability and performance issues:

  • testDockerMatrix started a new basic/docker container and booted dockerd for each subtest, taking over 15 minutes in total and timing out.
  • testDockerComposeBuild used d.WaitForOutput on dockerd daemon logs to find "Built", which is only printed to the CLI process, causing a 60s hang every time.
  • Asynchronous ExecProcess was used to write Dockerfile and docker-compose.yml, creating filesystem race conditions before docker compose executed.
  • log.Fatalf was used instead of t.Fatalf, aborting the test binary on YAML marshal errors and leaking containers.

This change fixes these issues by:

  • Spawning 1 outer Docker container per matrix (TestDockerWithVFS and TestDockerWithOverlay) and running the two matrices concurrently in parallel (t.Parallel()).
  • Running docker compose build synchronously with dockerInGvisorExecOutput and removing d.WaitForOutput.
  • Introducing writeFileInContainer to write container files synchronously and safely.
  • Replacing log.Fatalf with t.Fatalf and cleaning up temp files in all compose tests.
  • Checking process exit codes across all test execution helpers.

@copybara-service copybara-service Bot added the exported Issue was exported automatically label Jul 17, 2026
@copybara-service
copybara-service Bot force-pushed the test/cl949451402 branch 2 times, most recently from e20439f to cd85a67 Compare July 17, 2026 18:07
Previously, DinD image tests suffered from several stability and performance issues:
- `testDockerMatrix` started a new `basic/docker` container and booted `dockerd` for each subtest, taking over 15 minutes in total and timing out.
- `testDockerComposeBuild` used `d.WaitForOutput` on `dockerd` daemon logs to find `"Built"`, which is only printed to the CLI process, causing a 60s hang every time.
- Asynchronous `ExecProcess` was used to write `Dockerfile` and `docker-compose.yml`, creating filesystem race conditions before `docker compose` executed.
- `log.Fatalf` was used instead of `t.Fatalf`, aborting the test binary on YAML marshal errors and leaking containers.

This change fixes these issues by:
- Spawning 1 outer Docker container per matrix (`TestDockerWithVFS` and `TestDockerWithOverlay`) and running the two matrices concurrently in parallel (`t.Parallel()`).
- Running `docker compose build` synchronously with `dockerInGvisorExecOutput` and removing `d.WaitForOutput`.
- Introducing `writeFileInContainer` to write container files synchronously and safely.
- Replacing `log.Fatalf` with `t.Fatalf` and cleaning up temp files in all compose tests.
- Checking process exit codes across all test execution helpers.

PiperOrigin-RevId: 949675883
@copybara-service
copybara-service Bot merged commit c3faee8 into master Jul 17, 2026
1 of 3 checks passed
@copybara-service
copybara-service Bot deleted the test/cl949451402 branch July 17, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant