Skip to content

test: refactoring and cleanup on child-process tests - #32078

Closed
jasnell wants to merge 1 commit into
nodejs:masterfrom
jasnell:test-common-debug
Closed

test: refactoring and cleanup on child-process tests#32078
jasnell wants to merge 1 commit into
nodejs:masterfrom
jasnell:test-common-debug

Conversation

@jasnell

@jasnelljasnell commented Mar 3, 2020

Copy link
Copy Markdown
Member

Commit 1 in this scratches an itch I've had for a while: it adds a common.debug() to test/common/index.js that uses util.debuglog() as a way of avoiding use of console.log() statements in tests that are not part of the test itself.

To enable the debug output while running tests, set the environment variable NODE_DEBUG=test.

Commit 2 Makes a number of improvements to child process tests including use of the debuglog(), more must calls, and use of ../common/countdown where appropriate.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Mar 3, 2020
@gengjiawen

Copy link
Copy Markdown
Member

test parallel/test-child-process-fork-net-server failed.

@jasnell

Copy link
Copy Markdown
MemberAuthor

Interesting... it's passing locally for me. Will investigate.

@nodejs-github-bot

This comment has been minimized.

@jasnell

Copy link
Copy Markdown
MemberAuthor

Looks like one of the events in question is not emitted consistently across platforms. Trying again.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@jasnell

jasnell commented Mar 4, 2020

Copy link
Copy Markdown
MemberAuthor

Ok looks good now. The events in that test definitely are not very consistent. Added some TODO comments to encourage they be looked at again later.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@jasnell

Copy link
Copy Markdown
MemberAuthor

Finally, a good CI run. Turns out the actual emission of events in parallel/test-child-process-fork-net-server is quite flaky from one OS to the next to degree that we cannot make any guarantees about which are going to fire. That's very unfortunate really. I've added todo comments in case someone wishes to get back to it.

@jasnell
jasnell requested a review from TrottMarch 5, 2020 20:19
Comment threadtest/common/README.md Outdated
@BridgeARBridgeAR mentioned this pull request Mar 9, 2020
4 tasks
@sam-github

Copy link
Copy Markdown
Contributor

I assumed this would have landed already, and was just searching for the debug utility, with no luck.

We really need to be able to leave debug messages in tests, ones that normally have no output, but where the output can be turned on.

Every time I have to debug a test I start by injecting console.log statements into them so I know where they are failing... then delete them before PRing. Its not a good way to do things.

If the PR is stalled on the stability of tests, maybe the base feature can be PRed on its own?

@cjihrig

Copy link
Copy Markdown
Contributor

@sam-github I think it's stalled on this alternate proposal: #32078 (comment)

@jasnell

This comment has been minimized.

@jasnelljasnell changed the title test: add common.debug utility and improve child_process teststest: refactoring and cleanup on child-process testsMar 23, 2020
@jasnell

Copy link
Copy Markdown
MemberAuthor

Went head and removed the common.debug() from this PR to allow the improvements in the tests to move forward.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

jasnell added a commit that referenced this pull request Mar 24, 2020
PR-URL: #32078
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in d0c0e20

@jasnelljasnell closed this Mar 24, 2020
MylesBorins pushed a commit that referenced this pull request Mar 25, 2020
PR-URL: #32078
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
@MylesBorinsMylesBorins mentioned this pull request Mar 25, 2020
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
PR-URL: nodejs#32078
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
targos pushed a commit that referenced this pull request Apr 28, 2020
PR-URL: #32078
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
@targostargos mentioned this pull request May 2, 2020
targos pushed a commit that referenced this pull request May 10, 2020
This makes sure all usages of `util.debuglog()` must contain the
string 'test' as argument.
PR-URL: #32161
Refs: #32078
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
targos pushed a commit that referenced this pull request May 10, 2020
These rules only apply for the test folder and will already be
checked for.
PR-URL: #32161
Refs: #32078
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
codebytere pushed a commit that referenced this pull request May 11, 2020
This makes sure all usages of `util.debuglog()` must contain the
string 'test' as argument.
PR-URL: #32161
Refs: #32078
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
codebytere pushed a commit that referenced this pull request May 11, 2020
These rules only apply for the test folder and will already be
checked for.
PR-URL: #32161
Refs: #32078
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
codebytere pushed a commit that referenced this pull request Jun 7, 2020
This makes sure all usages of `util.debuglog()` must contain the
string 'test' as argument.
PR-URL: #32161
Refs: #32078
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
codebytere pushed a commit that referenced this pull request Jun 7, 2020
These rules only apply for the test folder and will already be
checked for.
PR-URL: #32161
Refs: #32078
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@jasnell@gengjiawen@nodejs-github-bot@sam-github@cjihrig@Trott@gireeshpunathil@BridgeAR@targos