Skip to content

fix(ci): wait for e2e port to free between suite spawns#48

Merged
ABB65 merged 1 commit into
mainfrom
fix/e2e-suite-port-race
May 15, 2026
Merged

fix(ci): wait for e2e port to free between suite spawns#48
ABB65 merged 1 commit into
mainfrom
fix/e2e-suite-port-race

Conversation

@ABB65
Copy link
Copy Markdown
Member

@ABB65 ABB65 commented May 15, 2026

Summary

PR #47 CI'sinde tests/e2e/project-content-review.e2e.test.ts GetPortError: Timeout waiting for port 4327 ile patladı (run 25912452254). Log:

[uncaughtException] Error: listen EADDRINUSE: address already in use 127.0.0.1:4327

Bu pre-existing bir test harness race condition — PR #47'nin diff'iyle alâkasız:

  • scripts/run-e2e-suite.mjs her *.e2e.test.ts dosyasını ardışık ayrı bir vitest run child process'i olarak başlatıyor.
  • Her e2e suite setupBrowserE2E(4327) ile Nuxt'u aynı sabit port'a kaldırıyor (tests/e2e/*.e2e.test.ts).
  • Önceki suite'in Nuxt server'ı port'u bırakmadan bir sonraki suite boot'a başlayınca EADDRINUSE → 20×500ms port-wait timeout → suite'in testleri skipped olarak işaretleniyor.
  • Bizim koşumuzda 5 e2e suite aynı port'ta sorunsuz boot etti, 6.'sı kapandı — klasik zamanlama race'i.

Fix

run-e2e-suite.mjs artık her suite arasında port 4327'nin gerçekten serbest kaldığını polling ile doğruluyor (yeni listener probe'u, 200ms aralık, 15s timeout). Magic sleep yok; gerçek koşulu bekliyoruz. Test dosyalarına dokunmadım, Nuxt boot sequence'ına dokunmadım — minimal, lokal fix.

Changes

  • scripts/run-e2e-suite.mjsisPortFree + waitForPortFree helper, suite döngüsünün sonunda await waitForPortFree(4327, '127.0.0.1', 15_000).

Test plan

Follow-up

İleride birden fazla e2e suite'i paralel koşturmak istersek her dosyaya unique port atamak ya da setupBrowserE2E() argümansız + dinamik port allocation'a geçmek gerekecek. Şimdilik kapsam dışı.

`scripts/run-e2e-suite.mjs` runs each `*.e2e.test.ts` file as its own
`vitest run` child process, but didn't wait for the previous Nuxt
server to release port 4327 before spawning the next suite. On CI this
intermittently surfaces as `listen EADDRINUSE: address already in use
127.0.0.1:4327` followed by `GetPortError: Timeout waiting for port
4327 after 20 retries with 500ms interval`, skipping the affected
suite's tests (most recently observed on PR #47, run 25912452254).

Every e2e file hard-codes `setupBrowserE2E(4327)`, so polling the
single shared port between suites is the minimal fix — no test-file
changes and no change to how Nuxt is booted. The check uses a
short-lived listener on the same port as a probe and bails after 15s
with a clear error.
@ABB65 ABB65 merged commit a0fdb2c into main May 15, 2026
1 check passed
@ABB65 ABB65 deleted the fix/e2e-suite-port-race branch May 15, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant