Skip to content

Commit 195f60d

Browse files
committed
e2e: enable OPcache for the dev server instead of multi-process workers
The previous PHP_CLI_SERVER_WORKERS approach caused flaky e2e runs: PHP's built-in server runs with OPcache disabled by default, so it recompiles the whole TYPO3 codebase on every request, and each of the 8 worker processes cold-started the framework on its first request. On CI the first attempt of each test then ran ~20-60s and timed out while retries (hitting warmed processes) passed — i.e. intermittent failures depending on which worker served a request. Run a single built-in-server process with OPcache enabled instead. After the codebase is compiled on the first request(s) the process serves subsequent requests quickly and deterministically, so a single warmed process is more reliable here than several cold-starting workers. Timeouts are bumped to give that first compile headroom on slower runners. Validated locally on PHP 8.4 for TYPO3 12.4 and 14.3: 4 passed each, no flaky retries. https://claude.ai/code/session_01DaMNs9bAk3ofegnToxwF7X
1 parent 76aa677 commit 195f60d

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

Build/playwright.config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import config from './tests/playwright/config';
33

44
export default defineConfig({
55
testDir: './tests/playwright',
6-
timeout: 60000,
7-
expect: { timeout: 15000 },
6+
// Generous timeouts: the first requests served by the PHP built-in server
7+
// compile the TYPO3 codebase into OPcache, which is slow on CI runners.
8+
timeout: 90000,
9+
expect: { timeout: 25000 },
810
fullyParallel: false,
911
forbidOnly: !!process.env.CI,
1012
retries: process.env.CI ? 2 : 0,

Build/runTests.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,19 @@ LOCAL_WEB_URL="http://${LOCAL_WEB_HOST}:${LOCAL_WEB_PORT}"
242242

243243
echo "Starting PHP built-in web server at ${LOCAL_WEB_URL}..."
244244
mkdir -p var/log
245-
# The TYPO3 backend loads many JavaScript (ES module) and asset requests in
246-
# parallel. The PHP built-in web server is single-threaded by default, which
247-
# serializes those requests and, on slower (CI) machines, makes the backend
248-
# module content miss the test timeout. Spawn multiple worker processes so the
249-
# server can answer requests concurrently.
250-
PHP_CLI_SERVER_WORKERS="${PHP_CLI_SERVER_WORKERS:-8}" \
251-
php -S "${LOCAL_WEB_HOST}:${LOCAL_WEB_PORT}" -t public/ >"${ROOT_DIR}/var/log/typo3-e2e-web.log" 2>&1 &
245+
# The PHP built-in web server is single-threaded and runs with OPcache disabled
246+
# by default, so it otherwise recompiles the whole TYPO3 codebase on every
247+
# request. On slower (CI) machines that makes the backend module content miss
248+
# the test timeout. Enabling OPcache lets the single process serve requests
249+
# quickly once the codebase is compiled on the first request(s). A single
250+
# (warmed) process is also more reliable here than multiple worker processes,
251+
# which would each cold-start the framework on their first request.
252+
php \
253+
-d opcache.enable_cli=1 \
254+
-d opcache.memory_consumption=256 \
255+
-d opcache.max_accelerated_files=30000 \
256+
-d opcache.validate_timestamps=0 \
257+
-S "${LOCAL_WEB_HOST}:${LOCAL_WEB_PORT}" -t public/ >"${ROOT_DIR}/var/log/typo3-e2e-web.log" 2>&1 &
252258
LOCAL_WEB_PID=$!
253259

254260
echo "Waiting for TYPO3..."

0 commit comments

Comments
 (0)