Browser plugin: a second Pest process deletes a running parallel run's playwright-server.json

オープン
#1,963 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php, playwright
領域
backend, testing

調査の方向性

Start with Plugin::terminate(), ServerManager::instance()->playwright()->stop(), PlaywrightNpmServer::stop(), and AlreadyStartedPlaywrightServer::markAsStopped() and fromPersisted(). Trace when the server address is persisted and when another Pest process removes it; reproduce with a parallel browser run and a second Pest process. Done when the second process can exit without removing the running run's server file, and the parallel browser tests continue to pass.

索引モデルが issue の本文から書いたものです。

説明

bug
Pest Version

5.1.1 (pest-plugin-browser 5.0.1)

PHP Version

8.4.23

Operation System

macOS

Description

When a parallel run (--parallel) is using the browser plugin, the parent process starts one Playwright server and writes its address to vendor/pestphp/pest-plugin-browser/.temp/playwright-server.json, which the workers read through AlreadyStartedPlaywrightServer::fromPersisted().

Plugin::terminate() calls ServerManager::instance()->playwright()->stop() in every non-worker process. That ends in PlaywrightNpmServer::stop(), which calls AlreadyStartedPlaywrightServer::markAsStopped() and unlinks the file unconditionally, even when the process never started a server.

So any other Pest process started in the same project while a parallel run is in progress deletes the file when it ends, and every remaining browser test of the parallel run fails with:

file_get_contents(.../vendor/pestphp/pest-plugin-browser/.temp/playwright-server.json): Failed to open stream: No such file or directory

This includes a second process that ends immediately without running any test, for example one that exits from the configured bootstrap file.

Steps to reproduce
  1. Run a suite with browser tests in parallel: ./vendor/bin/pest --parallel.
  2. While it runs, run any other Pest command in the same project, for example ./vendor/bin/pest tests/Unit/ExampleTest.php.
  3. Every browser test of the first run that starts after step 2 finishes fails with the error above.
Expected

markAsStopped() (or stop()) only removes the persisted file when this process started the server that wrote it, for example by keeping track of whether persist() was called in this process.

主要言語
PHP
スター
11.8k
フォーク
559
平均マージ
5日 23時間
マージ済み PR(30日)
24

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pestphp/pest のほかの issue

pestphp/pest の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。