From ceff9f3ffddc4a96958c0b3fdd5830e5cb473348 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 21 Oct 2023 11:00:33 +0200 Subject: [PATCH] build(.github) debug failing tests --- .github/workflows/{test.yaml => test-debug.yaml} | 13 ++----------- Makefile | 1 + src/ManagedProcess/PhpBuiltInServer.php | 10 +++------- 3 files changed, 6 insertions(+), 18 deletions(-) rename .github/workflows/{test.yaml => test-debug.yaml} (88%) diff --git a/.github/workflows/test.yaml b/.github/workflows/test-debug.yaml similarity index 88% rename from .github/workflows/test.yaml rename to .github/workflows/test-debug.yaml index 4fa7a9cb7..fb6a4c0c8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test-debug.yaml @@ -1,6 +1,6 @@ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow -name: Test +name: Test Debug on: # yamllint disable-line rule:truthy pull_request: @@ -33,16 +33,7 @@ jobs: matrix: php_version: [ '8.0', '8.1', '8.2' ] suite: - - acceptance - - climodule - - functional - - muloader - unit - - webdriver - - wpcli_module - - wploader_multisite - - wploader_wpdb_interaction - - wploadersuite name: ${{ matrix.suite }} php@${{ matrix.php_version }} runs-on: ubuntu-22.04 steps: @@ -87,7 +78,7 @@ jobs: - name: Run tests id: test - run: vendor/bin/codecept run ${{ matrix.suite }} + run: vendor/bin/codecept run tests/unit/lucatume/WPBrowser/ManagedProcess/PhpBuiltInServerTest.php --debug - name: Upload Artifacts uses: actions/upload-artifact@v2 diff --git a/Makefile b/Makefile index 4540757fd..a5d3b7983 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ clean_procs: pgrep -f 'php -S' | xargs kill pgrep chromedriver | xargs kill rm -f var/_output/*.pid var/_output/*.running + docker compose down .PHONY: clean_procs build_35: diff --git a/src/ManagedProcess/PhpBuiltInServer.php b/src/ManagedProcess/PhpBuiltInServer.php index 4e555cbda..5c5c3af8c 100644 --- a/src/ManagedProcess/PhpBuiltInServer.php +++ b/src/ManagedProcess/PhpBuiltInServer.php @@ -83,13 +83,9 @@ public function getPort(): int private function confirmServerRunningOnPort(Process $process): bool { - if ($process->getErrorOutput() === '') { - $process->waitUntil( - static function (string $type, string $output): bool { - return $type === Process::ERR && !empty($output); - } - ); - } + do { + $processOutput = $process->getErrorOutput(); + } while (stripos($processOutput, 'failed') === false && stripos($processOutput, 'started') === false); if (stripos($process->getErrorOutput(), 'failed') !== false) { return false;