From bad8393bedf28dc465e8e37c182c617d303b3c54 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Nov 2026 12:04:01 +0100 Subject: [PATCH] test(integration): Wait for federated server to have started Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Joas Schilling --- .../features/bootstrap/FederationContext.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index 6725b922d16c2..d260f8aec7294 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -41,6 +41,17 @@ public function startFederatedServer(): void { $port = getenv('PORT_FED'); self::$phpFederatedServerPid = exec('PHP_CLI_SERVER_WORKERS=2 php -S localhost:' . $port . ' -t ../../ >/dev/null & echo $!'); + + // Wait until the server accepts connections, as the following hooks + // (like the user cleanup) send requests to it right away. + for ($i = 0; $i < 100; $i++) { + $socket = @fsockopen('localhost', (int)$port); + if ($socket !== false) { + fclose($socket); + return; + } + usleep(100000); + } } /**