Fix flakiness, race conditions, and timeout in DinD image tests#13739
Merged
Conversation
copybara-service
Bot
force-pushed
the
test/cl949451402
branch
2 times, most recently
from
July 17, 2026 18:07
e20439f to
cd85a67
Compare
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
Bot
force-pushed
the
test/cl949451402
branch
from
July 17, 2026 18:37
cd85a67 to
c3faee8
Compare
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.
Fix flakiness, race conditions, and timeout in DinD image tests
Previously, DinD image tests suffered from several stability and performance issues:
testDockerMatrixstarted a newbasic/dockercontainer and booteddockerdfor each subtest, taking over 15 minutes in total and timing out.testDockerComposeBuildusedd.WaitForOutputondockerddaemon logs to find"Built", which is only printed to the CLI process, causing a 60s hang every time.ExecProcesswas used to writeDockerfileanddocker-compose.yml, creating filesystem race conditions beforedocker composeexecuted.log.Fatalfwas used instead oft.Fatalf, aborting the test binary on YAML marshal errors and leaking containers.This change fixes these issues by:
TestDockerWithVFSandTestDockerWithOverlay) and running the two matrices concurrently in parallel (t.Parallel()).docker compose buildsynchronously withdockerInGvisorExecOutputand removingd.WaitForOutput.writeFileInContainerto write container files synchronously and safely.log.Fatalfwitht.Fatalfand cleaning up temp files in all compose tests.