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: fix setTimeout, remove unused err #10193

Closed
wants to merge 1 commit into from

Conversation

amazingandyyy
Copy link
Contributor

file: test/parallel/test-domain-uncaught-exception.js

There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

There are four callbacks that take an argument called err but that
argument is never used, I just removed them.

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Dec 9, 2016
@amazingandyyy amazingandyyy changed the title minor update to test/parallel/test-domain-uncaught-exception.js test: fix setTimeout() and remove uunusable "err" in test-domain-uncaught-exception Dec 9, 2016
@amazingandyyy amazingandyyy changed the title test: fix setTimeout() and remove uunusable "err" in test-domain-uncaught-exception test: fix setTimeout() and remove unused "err" in test-domain-uncaught-exception Dec 9, 2016
@@ -14,7 +15,7 @@ timeoutd.on('error', common.mustCall(function(e) {
}));

timeoutd.run(function() {
setTimeout(function() {
setTimeout(function onTimeout() {
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

@@ -23,7 +23,7 @@ function test1() {
*/
const d = domain.create();
d.run(function() {
setTimeout(function onTimeout() {
setImmediate(function onSetImmediate() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The test used to test that exceptions thrown from setTimeout were in the domain, now they test that test thrown from setImmediate are still in the domain! I don't think you are looking at what the test is doing.

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 your point. Since it does not specify a duration (the second argument), I think it's more appropriate to change this call to setImmediate() instead of setTimeout().

Copy link
Member

Choose a reason for hiding this comment

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

For this test, instead of changing the setTimeout() to setImmediate(), it is better to keep setTimeout() but add a duration of 1. @sam-github is right. This is testing a timer, not an immediate. Changing it to an immediate changes the test. In other words, the setTimeout() is not an incidental tool used within the test. It is part of what is actually being tested.

(In @amazingandyyy's defense, I'm the one that suggested changing setTimeout() with no duration to setImmediate() in the first place. But yeah, that's not right in this test.)

process.send('errorHandledByDomain');
});

d5.run(function() {
d6.run(function() {
setTimeout(function onTimeout() {
setImmediate(function onSetImmediate() {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto. the point of the test isn't to run these functions, its to test interactions with timeouts and domains

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here, it does not specify a duration (the second argument), setImmediate is more appropriate.

Copy link
Member

@Trott Trott Dec 9, 2016

Choose a reason for hiding this comment

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

@sam-github is (as usual) right on this one too. We're testing that domains and setTimeout() interact the way they are supposed to, so it needs to be setTimeout(). Add a duration of 1 rather than changing it to setImmediate().

Copy link
Contributor

@sam-github sam-github left a comment

Choose a reason for hiding this comment

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

This looks to me like a combination of random code churn, and unintended changes to the function of the tests.

@mscdex mscdex added domain Issues and PRs related to the domain subsystem. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels Dec 9, 2016
@amazingandyyy amazingandyyy changed the title test: fix setTimeout() and remove unused "err" in test-domain-uncaught-exception test: fix setTimeout, remove unused err, add const Dec 9, 2016
@Trott
Copy link
Member

Trott commented Dec 9, 2016

I don't think the changes to test-domain-timers.js belong here. Can we please limit the scope of this PR to just test-domain-uncaught-exception.js?

process.send('errorHandledByDomain');
});

d9.run(function() {
d10.run(function() {
setTimeout(function onTimeout() {
setImmediate(function onSetImmediate() {
Copy link
Member

Choose a reason for hiding this comment

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

Same here: Use setTimeout() with a duration of 1 instead of setImmediate().

@amazingandyyy amazingandyyy changed the title test: fix setTimeout, remove unused err, add const test: fix setTimeout, remove unused err Dec 10, 2016
@sam-github
Copy link
Contributor

Commits need to be squashed

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

LGTM

Squashing commits can also be done by whoever lands the PR, btw.

@sam-github
Copy link
Contributor

@addaleax, it can, but last time I did that @mhdawson suggested I ask the PR author. Rebasing is part of the work flow, so knowing how to do that helps get people up to speed with node work habits. On the other hand, doing it for them makes it easier. I don't care.

@amazingandyyy do you want to squash, or do you want me to?

@addaleax
Copy link
Member

@sam-github Right, but squashing and rebasing can be tricky depending on somebody’s git experience level, so I like to mention that it’s optional.

@amazingandyyy
Copy link
Contributor Author

@sam-github @addaleax I just do "git rebase -i HEAD~6" and then replace "pick" by "squash" then save the file.

I am not sure if this works? I still see 6 commits on this PR. I appreciate this practicing chance.

btw, Please feel free to squash it(if my rebasing doesn't work) when landing, thanks!

@italoacasas
Copy link
Contributor

@amarzavery the last step is to comment all the msg except one (the one that you are going to use as a commit msg)

@addaleax
Copy link
Member

@amazingandyyy That sounds about right, except you’ll need to keep the first commit as pick

file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.
@amazingandyyy
Copy link
Contributor Author

Thank you! @italoacasas and @addaleax

I leave one as pick and clean commit message, then got

amazingandyyy ~/projects/node $ git rebase -i HEAD~6
[detached HEAD 8d0badb] minor update to test/parallel/test-domain-uncaught-exception.js
 Date: Fri Dec 9 00:03:13 2016 -0800
 1 file changed, 7 insertions(+), 7 deletions(-)
Successfully rebased and updated refs/heads/master.

but I still see 6 commits on this PR, do I miss any step or what's next step to complete(make the squashing work?) Thanks

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@mhdawson
Copy link
Member

@mhdawson
Copy link
Member

@amazingandyyy just noticed that the commit message does not fit our contributor guidelines. I'll fix up as part of landing but can you review the guidelines for the next time.

The commit message should start with a prefix. In this case 'test:' and the length needs to be less than or equal to 50 chars. See https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit

@mhdawson
Copy link
Member

CI failure on arm was #10073, so not related to this change so CI is good. Will land.

@mhdawson
Copy link
Member

@amazingandyyy one more thing for the next time as well. We need your full name in the commit. I've amended while landed but fore the next time can you make sure its set to:

Andy Chen <amazingandyyy@gmail.com>

@mhdawson
Copy link
Member

landed as e27c2a7

@mhdawson mhdawson closed this Dec 14, 2016
mhdawson pushed a commit that referenced this pull request Dec 14, 2016
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@amazingandyyy
Copy link
Contributor Author

@mharsch thank you! I will follow contributor guidelines and add my full name next time! Thank you for posting reference!

@Trott
Copy link
Member

Trott commented Dec 14, 2016

We need your full name in the commit.

We do not need anyone's name for commits. It is up to them.

@Trott
Copy link
Member

Trott commented Dec 14, 2016

(Always good to ask first-time contributors, though, of course! People forget to set the name all the time. So, it's a nice gesture to make sure they are making a conscious choice in the matter. I'm just reacting to the "need your full name" phrasing. If someone wants to be "Pat" or "avatar-46", that's their choice.)

MylesBorins pushed a commit that referenced this pull request Dec 15, 2016
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@italoacasas italoacasas mentioned this pull request Dec 15, 2016
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This was referenced Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
file: test/parallel/test-domain-uncaught-exception.js

1. There are three setTimeout() in the file and they do not specify a
duration (the second argument), so I change them to setImmediate()
instead.

2. There are four callbacks that take an argument called `err` but that
argument is never used, so I removed them.

PR-URL: #10193
Reviewed-By: Sam Roberts <sam@strongloop.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain Issues and PRs related to the domain subsystem. test Issues and PRs related to the tests. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.