Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Mar 3, 2020

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-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Mar 3, 2020
@gengjiawen
Copy link
Member

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

@jasnell
Copy link
Member Author

jasnell commented Mar 4, 2020

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

@nodejs-github-bot

This comment has been minimized.

@jasnell
Copy link
Member Author

jasnell commented Mar 4, 2020

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
Copy link
Member Author

jasnell commented Mar 4, 2020

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
Collaborator

@jasnell
Copy link
Member Author

jasnell commented Mar 5, 2020

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 Trott March 5, 2020 20:19
test/common/README.md Outdated Show resolved Hide resolved
@BridgeAR BridgeAR mentioned this pull request Mar 9, 2020
4 tasks
@sam-github
Copy link
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
Contributor

cjihrig commented Mar 20, 2020

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

@jasnell

This comment has been minimized.

@jasnell jasnell changed the title test: add common.debug utility and improve child_process tests test: refactoring and cleanup on child-process tests Mar 23, 2020
@jasnell
Copy link
Member Author

jasnell commented Mar 23, 2020

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
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
Member Author

jasnell commented Mar 24, 2020

Landed in d0c0e20

@jasnell jasnell 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>
@MylesBorins MylesBorins 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>
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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants