Skip to content

fix(test): increase connect-timeout guard timeout and use Promise.race#5230

Open
mcollina wants to merge 1 commit intomainfrom
fix/flaky-connect-timeout-test
Open

fix(test): increase connect-timeout guard timeout and use Promise.race#5230
mcollina wants to merge 1 commit intomainfrom
fix/flaky-connect-timeout-test

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 6, 2026

Fixes #5187.

The guard timeout of 2000ms was too tight for the 1000ms connect timeout on
slower CI runners (e.g. Windows), causing the test to flakily fail with
t.fail() before the expected callback fired.

Changes:

  • Increased guard timeout from 2000ms to 5000ms for headroom
  • Replaced bare t.fail() with t.fail('...') + descriptive message
  • Wrapped the request callback in Promise.race with t.completed so the
    test resolves cleanly when assertions succeed rather than relying solely on
    t.completed which can hang after fail()

The guard timeout of 2000ms was too tight for the 1000ms connect
timeout on slower CI runners (e.g. Windows), causing the test to
flakily fail with t.fail() before the expected callback fired.

Changes:
- Increased guard timeout from 2000ms to 5000ms for headroom
- Replaced bare t.fail() with t.fail() + descriptive message
- Wrapped the request callback in Promise.race with t.completed
  so the test resolves cleanly when assertions succeed rather
  than relying solely on t.completed which can hang after fail()
@trivikr
Copy link
Copy Markdown
Member

trivikr commented May 6, 2026

Looks like one of the commits from this PR was pushed to main by mistake in e58fff7

Should we enable branch protection on main to require pull requests, to avoid pushes by mistake?

Copy link
Copy Markdown
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

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

lgtm, just merge conflicts

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.

[flaky] test\connect-timeout.js

3 participants