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

Aperta Adatta ai principianti
#19,068 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, nodejs
Ambito
testing-qa

Direzione di ricerca

Inizia da server/services/pm2.daemonIdentity.test.js, dove la fixture costruisce il percorso RPC dalla radice temporanea di Vitest e imposta PM2_DAEMON_RPC_PORT, poi leggi il controllo preliminare della lunghezza del socket in server/services/pm2.js. Esegui npm test --prefix server -- services/pm2.daemonIdentity.test.js con un TMPDIR annidato per riprodurre i fallimenti. È completato quando la fixture usa un indirizzo RPC sintetico e breve con esistenza simulata, tutti e quattro i test passano con una radice temporanea lunga e la copertura di produzione per la lunghezza superiore al limite continua a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
JavaScript
Stelle
38
Fork
32
Merge medio
14m
PR unite (30g)
995

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di atomantic/PortOS

Tutte le issue di atomantic/PortOS

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.