Skip to content

doc: recommend node-stress-single-test for flaky tests#64223

Open
trivikr wants to merge 6 commits into
nodejs:mainfrom
trivikr:doc-node-stress-single-test
Open

doc: recommend node-stress-single-test for flaky tests#64223
trivikr wants to merge 6 commits into
nodejs:mainfrom
trivikr:doc-node-stress-single-test

Conversation

@trivikr

@trivikr trivikr commented Jul 1, 2026

Copy link
Copy Markdown
Member

Recommend node-stress-single-test in the collaborator guide and onboarding
docs for validating fixes to flaky tests.

Refs: https://openjs-foundation.slack.com/archives/C03BJP63CH0/p1782716150521499

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Jul 1, 2026
@trivikr trivikr requested review from aduh95, joyeecheung and sxa July 1, 2026 02:35
Add guidance to the collaborator guide and onboarding docs recommending
node-stress-single-test when fixing flaky tests, so contributors verify
stability under repeated runs.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@trivikr trivikr force-pushed the doc-node-stress-single-test branch from f20aca5 to ef9208e Compare July 1, 2026 02:45
@trivikr trivikr added the flaky-test Issues and PRs related to the tests with unstable failures on the CI. label Jul 1, 2026
Comment thread doc/contributing/collaborator-guide.md Outdated
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@trivikr trivikr requested a review from aduh95 July 1, 2026 06:57
@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 1, 2026

@sxa sxa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggest adding the hyperlink in, but approving regardless 👍🏻

Comment thread onboarding.md Outdated
* If you are interested in helping out with CI reliability, check out the
[reliability repository][] and [guide on how to deal with CI flakes][].
[reliability repository][] and [guide on how to deal with CI flakes][]. When
fixing a flaky test, it is recommended to run [`node-stress-single-test`][]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
fixing a flaky test, it is recommended to run [`node-stress-single-test`][]
fixing a flaky test, it is recommended to run [`node-stress-single-test`][https://ci.nodejs.org/job/node-stress-single-test]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Mentioning the hyperlink in the bottom improves the source code readability, right?

It's done twice on line 289 for example.

[reliability repository][] and [guide on how to deal with CI flakes][].

Comment thread onboarding.md Outdated
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
@trivikr trivikr requested a review from joyeecheung July 1, 2026 16:14
@lpinca

lpinca commented Jul 1, 2026

Copy link
Copy Markdown
Member

It is not very useful if the flaky test is in test/parallel because afaik the job runs the test sequentially.

@trivikr

trivikr commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

It is not very useful if the flaky test is in test/parallel because afaik the job runs the test sequentially.

The node-stress-single-test is still helpful for sequential tests.
Do you have a suggestion on how to phrase it in documentation?

@lpinca

lpinca commented Jul 1, 2026

Copy link
Copy Markdown
Member

How about something like "When fixing a flaky test in test/sequentual, it is recommended to run node-stress-single-test. It is also good for tests in in test/parallel, but not very reliable because the job runs the test sequentially".

@trivikr trivikr removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 1, 2026
Comment thread onboarding.md Outdated
@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 2, 2026
Comment thread onboarding.md Outdated
Comment thread onboarding.md Outdated
trivikr and others added 2 commits July 1, 2026 23:44
@trivikr trivikr requested a review from aduh95 July 2, 2026 06:45
@sxa

sxa commented Jul 2, 2026

Copy link
Copy Markdown
Member

How about something like "When fixing a flaky test in test/sequentual, it is recommended to run node-stress-single-test. It is also good for tests in in test/parallel, but not very reliable because the job runs the test sequentially".

I'll be honest I've found it to be good for parallel tests as well. Even though it's theoretically possible that we'd get issues with bad interactions/conflicts when running alongside other tests in the parallel suite I don't think I've personally come across a situation where the fact that it's a parallel test has caused it not to show up in the stress job so I would dispute the "not very reliable" suggestion here and definitely would not discourage people from using the stress job for parallel tests. Curious as to whether others people's experiences are different from mine. And if a test is flaky because it's in the parallel suite, then the solution is probably to move it to sequential.

@lpinca

lpinca commented Jul 2, 2026

Copy link
Copy Markdown
Member

I've run into a lot of cases where node-stress-single-test never failed and the flakiness was reproducible only by using -j 16 --repeat=1000.

And if a test is flaky because it's in the parallel suite, then the solution is probably to move it to sequential.

I disagree. In most cases it would only hide the underlying issue.

@sxa

sxa commented Jul 2, 2026

Copy link
Copy Markdown
Member

I've run into a lot of cases where node-stress-single-test never failed and the flakiness was reproducible only by using -j 16 --repeat=1000.

Thanks - good to know that I've just been lucky!

@joyeecheung

Copy link
Copy Markdown
Member

I think there are multiple uses for the stress test:

  1. For parallel testing, to put it under load
  2. For sequential testing, to simply sample many many runs

It is not inherently less reliable when you run it sequentially, it just means in that case you are not putting it under load and are merely sampling many runs, which is also a valid, reliable way to use it, just be aware that it's for a different purpose.

One solution is to make -j configurable in Jenkins, I just added a workflow that allows stress testing with a configurable -j in #64118 for the same reason.

@trivikr trivikr removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 2, 2026
@trivikr

trivikr commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

FWIW I started using the stress test on main to verify flaky tests mentioned on nodejs/reliability after it was called out in #64223 (comment), and 4/5 flaky tests have failed in their stress tests:

I'm not sure how reliable the stress tests are, but I'll follow what the existing more experienced maintainers recommend.
If these tests can be run automatically, that would make it easy. The solution I would love to see is similar to what request-ci does, i.e. run CI for PRs.

Maybe flaky-test label can run CI on main as well as PR branch and post a comment?
The GitHub workflow which @joyeecheung mentioned in the above comment goes in that direction.


To unblock this PR, I've re-requested approval from @sxa who'd raised concerns about effectivity of stress tests for parallel tests. If they provide their approval, I'll request merging the PR.

We can update the documentation later when -j gets configurable in jenkins. WDYT?

Alternative is to remove sections of sequential and parallel from this PR.

@trivikr trivikr requested a review from sxa July 2, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. flaky-test Issues and PRs related to the tests with unstable failures on the CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants