Skip to content

test: stabilize flaky fs.watch and worker-scaler tests - #4806

Merged
mcollina merged 1 commit into
mainfrom
fix/flaky-tests-fs-watch-and-worker-scaler
May 29, 2026
Merged

mcollina merged 1 commit into
mainfrom
fix/flaky-tests-fs-watch-and-worker-scaler

Conversation

@mcollina

Copy link
Copy Markdown
Member

Summary

  • Skip the two FileWatcher tests that exercise fs.watch on Windows + Node 24. They abort the process with Assertion failed: !_wcsnicmp(filename, dir, dirlen), file src\win\fs-event.c, line 72 — a libuv regression tracked upstream at nodejs/node#63638. The skip is gated on process.platform === 'win32' && Node ≥ 24 so the tests keep running everywhere they're known to be safe.
  • Rewrite the worker-scaler "should not scale during cooldown" test to drive sustained CPU load in the background and poll for the expected worker count instead of issuing a single short burst and sleeping a fixed 10s. The original shape was timing-fragile: the worker was blocked during the burst, the scaler's health check often couldn't observe the high ELU before the load ended, and the assertion landed at 1 worker instead of 2. With polling and continuous load the scale-up is observed deterministically — typical run time dropped to ~2s, with a 30s upper bound.

Test plan

  • packages/foundation — node --test test/file-system.test.js (22/22 pass locally on Linux + Node 24)
  • packages/runtime — node --test --test-concurrency=1 test/worker-scaler-1.test.js (15/15 pass locally; the previously flaky cooldown test passes in both default and worker-scaler configurations)
  • CI: confirm foundation - windows-2025 - 24 and runtime - * - main jobs are green

🤖 Generated with Claude Code

- Skip the two FileWatcher tests that exercise fs.watch on Windows + Node 24
  to avoid the libuv assertion in src/win/fs-event.c tracked upstream as
  nodejs/node#63638.
- Replace the single short CPU burst + fixed sleep in the worker-scaler
  cooldown test with sustained load and polling for the expected worker
  count, so the scale-up is observed deterministically.

Assisted-by: claude-code:claude-opus-4-7
Signed-off-by: Matteo Collina <[email protected]>
@mcollina
mcollina requested review from ShogunPanda and ivan-tymoshenko and removed request for ShogunPanda May 29, 2026 10:35

@marcopiraccini marcopiraccini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@mcollina
mcollina merged commit 8e8d855 into main May 29, 2026
155 checks passed
@mcollina
mcollina deleted the fix/flaky-tests-fs-watch-and-worker-scaler branch May 29, 2026 13:29
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.

3 participants