Remove xdist_group("build") serialization from slow tests#415
Merged
Conversation
7452c82 to
2e65813
Compare
ianpittwood
reviewed
Apr 2, 2026
Contributor
ianpittwood
left a comment
There was a problem hiding this comment.
I think this is a reasonable change, but I want to ask a few questions before we proceed:
- Are all of the build calls using
get_tmpconfig? They should be and I see many have been changed here already, but we should confirm one more time that there aren't any other build calls buried in the tests for other modules. - Would it be good practice to use
--no-cachefor the in pytest builds too? All of the Dockerfiles should be relatively quick to build and it may be good practice to ensure they are built from end-to-end each time to ensure things like our macros are still functioning properly. - Buildkit can be quite hefty on RAM. Do we want to make any developer notes on restricting simultaneous builds to a certain number?
0e60d83 to
0ebf6cf
Compare
Replace @slow with @image_build on tests that build real Docker
images, and remove the xdist_group("build") serialization that
forced them onto a single pytest-xdist worker.
Isolate tests via unique registry namespaces so image tags never
collide on the shared Docker daemon:
- get_tmpcontext rewrites bakery.yaml registry namespaces with a
unique suffix for image_build tests (e.g., posit-dev/t-a1b2c3d4)
- BDD verification/cleanup steps use get_tmpconfig to read from
the temp copy with rewritten tags
- test_image_target.py build tests use get_tmpconfig instead of
get_targets to build from isolated copies
- just test-all uses -n 4 to limit parallel builds on dev machines
More cores means more pytest-xdist workers, which lets the now un-serialized image build tests run in parallel and reduces wall clock time.
0ebf6cf to
80c9aba
Compare
Autouse fixture patches ImageTarget.build and BakePlan.build to default cache=False for all image_build-marked tests. This ensures templates and macros are tested end-to-end without stale layers masking regressions. Covers both direct Python .build() calls and BDD scenarios that invoke the bakery CLI (which calls the same methods internally).
62d8d04 to
eed791f
Compare
Contributor
Author
I verified that the bakery build calls all use this fixture. I also changed the mark to
I added a commit to disable the cache by default to see what it does to the build time. My intent w/ this PR was to speed up the test run.
I changed the justfile default to |
ianpittwood
approved these changes
Apr 3, 2026
Contributor
ianpittwood
left a comment
There was a problem hiding this comment.
Let's give it a try!
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 build group forced all slow tests onto a single pytest-xdist
worker, serializing ~19 Docker build tests even though most have no
shared state that would cause conflicts:
The serialization was overly conservative, preventing xdist from
distributing slow tests across available workers.