Skip to content

chore(test): issue 3969#5005

Merged
mcollina merged 1 commit intonodejs:mainfrom
rozzilla:chore/test/issue-3969
Apr 9, 2026
Merged

chore(test): issue 3969#5005
mcollina merged 1 commit intonodejs:mainfrom
rozzilla:chore/test/issue-3969

Conversation

@rozzilla
Copy link
Copy Markdown
Contributor

@rozzilla rozzilla commented Apr 9, 2026

This relates to...

Fixes #3969

Rationale

The test was timing out intermittently when run under full suite pressure (npm run test:unit) because it relied on a fixed 500ms wall-clock sleep rather than synchronizing on actual async operations. The test was blindly hoping that the sleep time would settle all the internal state, but under stress pressure, that assumption breaks. Additionally, the RetryAgent was never explicitly closed, potentially causing resource leaks or stale state between tests in the suite.

Changes

  • Remove await sleep(500) to eliminate the wall-clock wait that masked timing races
  • Move agent instantiation before teardown to allow reference in the after() hook for proper cleanup
  • Add await agent.close() in teardown to ensure RetryAgent resources are explicitly released

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

Status

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.92%. Comparing base (d3ea390) to head (7f52e29).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5005   +/-   ##
=======================================
  Coverage   92.92%   92.92%           
=======================================
  Files         110      110           
  Lines       35729    35735    +6     
=======================================
+ Hits        33201    33208    +7     
+ Misses       2528     2527    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 51a27b7 into nodejs:main Apr 9, 2026
35 checks passed
@github-actions github-actions bot mentioned this pull request Apr 12, 2026
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.

test/issue-3356.js very flaky when run with test runner

3 participants