Skip to content

test: consolidate test isolation on the fork-based approach#816

Merged
lucatume merged 4 commits into
masterfrom
refactor/fork-test-isolation
Jul 4, 2026
Merged

test: consolidate test isolation on the fork-based approach#816
lucatume merged 4 commits into
masterfrom
refactor/fork-test-isolation

Conversation

@lucatume

@lucatume lucatume commented Jul 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

lucatume added 4 commits July 4, 2026 22:58
Rewire LoopIsolation::assertInIsolation to Fork::executeClosure, dropping
the Loop subprocess path for test isolation. Fork children now report
exit-path throwables (e.g. LoadSandbox not-installed flows) through a
shutdown hook registered in the global bootstrap, ahead of Codeception's
ErrorHandler shutdown handler that would exit(125) first. The parent read
loop detects EOF and surfaces child deaths instead of spinning. WP function
shims move out of Fork into the fork closures of the tests needing them,
so forks loading real WordPress do not fatal on redeclared functions.
It is DB-free and instantiates the stub wpdb classmap double in the suite
process; under fork-based isolation that poisons later forks loading real
WordPress with a wpdb redeclaration fatal. The unit suite process never
loads real WordPress in forks.
Honor fwrite return values when chunking the result payload; base64-encode
the payload so the terminator cannot appear inside it; report a clear error
when the child exits without a result; restore the 30s read timeout the
Loop-based isolation had (unbounded under --debug); guard the fork-failure
and pcntl_fork fall-through paths; check chdir in assertInIsolation. Drop
the unused quiet/chunk-size/terminator knobs.
Silence EINTR warnings from stream_select in the read loop, include the
last PHP error in the exit-without-result report, drop the single-use
instance API and the dead returned-Throwable rethrow.
@lucatume lucatume self-assigned this Jul 4, 2026
@lucatume lucatume merged commit 173ed40 into master Jul 4, 2026
52 checks passed
@lucatume lucatume deleted the refactor/fork-test-isolation branch July 4, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant