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

common.mustCall() is added #34920

Closed
wants to merge 3 commits into from
Closed

Conversation

PoojaDurgad
Copy link
Contributor

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 Aug 25, 2020
 Please enter the commit message for your changes. Lines starting
@HarshithaKP HarshithaKP added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 30, 2020
@nodejs-github-bot
Copy link
Collaborator

@@ -32,19 +32,19 @@ const cp = require('child_process');
if (process.argv[2] === 'server') {
// Server

const server = net.createServer(function(conn) {
const server = net.createServer(common.mustCall(function(conn) {
Copy link
Member

Choose a reason for hiding this comment

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

This gives a false sense of security. This is a child process and if the child process fails, it doesn't affect the test. You can see this if you add a 2 as the second argument to common.mustCall() so that it causes an assertion. It will print the assertion message, but the test still passes.

$ ./node test/sequential/test-net-response-size.js
Server running.
server received 65536 bytes
server received 36864 bytes
server received 1 bytes
Mismatched <anonymous> function calls. Expected exactly 2, actual 1.
    at Proxy.mustCall (/Users/trott/io.js/test/common/index.js:329:10)
    at Object.<anonymous> (/Users/trott/io.js/test/sequential/test-net-response-size.js:35:42)
    at Module._compile (internal/modules/cjs/loader.js:1090:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1111:10)
    at Module.load (internal/modules/cjs/loader.js:955:32)
    at Function.Module._load (internal/modules/cjs/loader.js:796:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
$ tools/test.py test/sequential/test-net-response-size.js
[00:01|% 100|+   1|-   0]: Done                          
$ 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand that this is not so useful because common.mustcall() is enclosed in child process. Thanks for the replay and I will close the PR.


server.listen(common.PORT, '127.0.0.1', function() {
server.listen(common.PORT, '127.0.0.1', common.mustCall(function() {
Copy link
Member

Choose a reason for hiding this comment

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

Same problem as above.

$ ./node test/sequential/test-net-response-size.js       
Server running.
server received 65536 bytes
server received 36864 bytes
server received 1 bytes
Mismatched <anonymous> function calls. Expected exactly 2, actual 1.
    at Proxy.mustCall (/Users/trott/io.js/test/common/index.js:329:10)
    at Object.<anonymous> (/Users/trott/io.js/test/sequential/test-net-response-size.js:45:50)
    at Module._compile (internal/modules/cjs/loader.js:1090:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1111:10)
    at Module.load (internal/modules/cjs/loader.js:955:32)
    at Function.Module._load (internal/modules/cjs/loader.js:796:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
$ tools/test.py test/sequential/test-net-response-size.js
[00:01|% 100|+   1|-   0]: Done                          
$

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

Welcome, @PoojaDurgad, and thanks for the pull request! I appreciate the effort, but I don't think we should do this for the reasons described in the comments.

@PoojaDurgad
Copy link
Contributor Author

Thanks,@Trott ,for reviewing my pull request and I understand that this is not so useful.

@PoojaDurgad PoojaDurgad mentioned this pull request Aug 31, 2020
4 tasks
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.

4 participants