Decouple mocked PM2 daemon identity checks from the test temp-root length

オープン 初心者向け
#19,068 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

server/services/pm2.daemonIdentity.test.js から始めてください。ここでは fixture が Vitest の一時ルートから RPC パスを組み立て、PM2_DAEMON_RPC_PORT を設定しています。その後、server/services/pm2.js にあるソケット長の事前チェックを読んでください。入れ子になった TMPDIR を指定して npm test --prefix server -- services/pm2.daemonIdentity.test.js を実行し、失敗を再現してください。fixture が存在確認をモックした短い合成 RPC アドレスを使い、長い一時ルートでも 4 つのテストがすべて通り、上限を超える本番コードのカバレッジも引き続き通れば完了です。

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

説明

area:testing bug effort:low model:light plan planner:gpt-6-2-sol tests

Reproduction

On macOS, run npm test --prefix server -- services/pm2.daemonIdentity.test.js with an existing nested TMPDIR that yields a 115-byte fixture RPC path. Three of the four tests fail. The two existing-daemon reads return null, and the disconnected client's close spy receives zero calls. Pointing TMPDIR at a short alias of the same physical directory passes all four tests with identical code and dependencies.

Cause and impact

server/services/pm2.daemonIdentity.test.js appends pm2-identity-XXXXXX/rpc.sock to the Vitest temp root and uses the resulting path as PM2_DAEMON_RPC_PORT. It writes an ordinary placeholder file and mocks PM2. The production preflight in server/services/pm2.js rejects the synthetic path before reaching the mocked RPC behavior under test. Its 103-byte macOS limit is correct. This interrupts a full server suite when an otherwise valid temporary root is nested. The test and implementation matched default-branch blobs c6538dc2cc and 0f1a042ac3 when reproduced during #19040.

Fix and acceptance

  • Have the fixture provide a short synthetic RPC address and control its existence in the mocked filesystem boundary. Preserve the missing, connected and disconnected cases and their RPC, teardown and no-start assertions.
  • Confirm all four tests pass with a short temp root and a nested root that previously produced a 115-byte fixture socket. Keep the production socket checks and their dedicated over-length coverage intact.
主要言語
JavaScript
スター
38
フォーク
32
平均マージ
14分
マージ済み PR(30日)
995

環境構築

はじめの一歩

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

atomantic/PortOS のほかの issue

atomantic/PortOS の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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