Repository navigation
Run parallel workers in throwaway Docker containers - #408
Draft
schlessera wants to merge 5 commits into
Draft
schlessera wants to merge 5 commits into
schlessera wants to merge 5 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
schlessera
force-pushed
the
perf/docker-workers
branch
2 times, most recently
from
October 30, 2026 20:42
d32576d to
325b181
Compare
schlessera
force-pushed
the
perf/parallel-scenarios
branch
from
October 31, 2026 11:17
0a546f4 to
79d8dda
Compare
schlessera
force-pushed
the
perf/docker-workers
branch
from
October 31, 2026 11:17
c5497c6 to
40a5693
Compare
schlessera
force-pushed
the
perf/docker-workers
branch
from
October 31, 2026 11:25
40a5693 to
69e9aaf
Compare
With WP_CLI_TEST_DOCKER set and Docker available, every worker runs in its own container, next to its own database server container of the same type and version as the configured one. Workers share no network, temporary directory or database, so any of them can run any scenario, including the ones using fixed ports or fixed temporary paths. The database servers keep their data in memory. The containers run the same PHP version as the host, which the project's Composer dependencies are installed for, and use WordPress as downloaded once by the host. Where the image cannot be built or the database server cannot be identified, the scenarios run without Docker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test outcomes depend on how PHP reports errors. Without a php.ini, the containers reported E_ALL, which WP-CLI keeps while testing, whereas the CI runners report -1, which WP-CLI reduces to everything but deprecations. Scenarios running older WordPress versions on PHP 8 therefore failed in the containers on deprecation notices that the runners never print. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera
force-pushed
the
perf/docker-workers
branch
from
October 31, 2026 13:37
69e9aaf to
cab964e
Compare
Background processes such as the built-in web server are stopped through ps, without which they keep their port for the next scenario. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… PHP version WP_CLI_TEST_DOCKER=auto runs the scenarios without Docker where it cannot be used, and reports why. 1 fails instead. Scenarios selected by path or name run in a single container. WP_CLI_TEST_DOCKER_PHP runs the containers on another PHP version than the host's, with the Composer dependencies installed for it. Options taking a value, as in --format progress, are no longer mistaken for paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Addresses the first two steps of #391. Builds on #405.
With
WP_CLI_TEST_DOCKERset, the scenarios run in throwaway containers, every parallel worker in its own, next to its own database server container. This makes the workers fully independent:WP_CLI_TEST_DOCKER_DBnames an image, and keep their data in memory.Docker stays optional:
WP_CLI_TEST_DOCKER0,no,offauto1,yes,onDocker cannot be used on Windows, when collecting code coverage, when it is not available, when the image cannot be built or when the database server cannot be identified.
The containers run the host's PHP version, unless
WP_CLI_TEST_DOCKER_PHPsets another one, e.g.7.4. The project's Composer dependencies are then installed for that version in a separate directory (about 3 seconds with a warm Composer cache), and refreshed once a day. Dependencies linked to local checkouts, as inwp-cli/wp-cli-dev, come from their published versions in that case, which is reported. The image falls back to the Debian archive for PHP versions whose base images are on archived Debian releases.Locally, the 97 scenarios of this package take 68 seconds serially, 35 seconds with 4 parallel workers, 41 seconds with 4 workers in containers on the host's PHP 8.5, and 30 seconds in containers on PHP 7.4.
cache-commandran the same 24 scenarios and 478 steps as a serial run with 4 workers, in 59 seconds including about 8 seconds for starting the containers and database servers. The third step of #391, restoring the cached installation as a copy-on-write snapshot, needs elevated privileges in the containers and is left for later.This also stops options that take a value, as in
--format progress, from being taken for paths, which made the scenarios run one after the other.Measurements on CI are recorded on #391.