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: clarify role of domains in microtask queue tests #4474

Closed
wants to merge 1 commit into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Dec 30, 2015

Add this comment:

> Requiring domain calls _setupDomainUse which in turns changes the
> tickCallback function that is used to call callbacks scheduled with
> process.nextTick.
>
> So requiring domain tests the _tickDomainCallback function, whereas
> the tests equivalent tests without domain test the _tickCallback
> function.

Also removes unnecessary assignment of domain module to a variable.

R: @misterdjules
R: @jasnell

@Trott Trott added domain Issues and PRs related to the domain subsystem. test Issues and PRs related to the tests. labels Dec 30, 2015
@jasnell
Copy link
Member

jasnell commented Dec 30, 2015

@misterdjules

@misterdjules
Copy link

Requiring domains calls _setupDomainUse which in turns changes the tickCallback function that is used to call callbacks scheduled with process.nextTick.

So these tests test the _tickDomainCallback function, whereas the tests without the domain suffix in the file name test the _tickCallback function.

Thus I would think we don't want to remove them.

@jasnell
Copy link
Member

jasnell commented Dec 30, 2015

+1 to @misterdjules comments. However, it might be a good idea to add some comments into the test files themselves that explain so that the require('domain') isn't removed in the future.

@Trott
Copy link
Member Author

Trott commented Dec 30, 2015

Would it be OK to change the relevant lines from this:

var domain = require('domain');

To just this?:

require('domain');

(Along with adding a comment per @jasnell.)

If so, I'll go ahead and do that (unless someone else is very motivated to do it).

@misterdjules
Copy link

@jasnell @Trott Both your suggestions sound good to me.

@Trott Trott changed the title test: remove domain tests that do not test test: clarify role of domains in microtask queue tests Dec 31, 2015
@Trott
Copy link
Member Author

Trott commented Dec 31, 2015

Rebased, updated, force pushed, changed description and title here. PTAL.

@cjihrig
Copy link
Contributor

cjihrig commented Dec 31, 2015

LGTM

@@ -1,7 +1,16 @@
'use strict';
require('../common');
var assert = require('assert');
var domain = require('domain');

// Requiring domain calls _setupDomainUse which in turns changes the

Choose a reason for hiding this comment

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

Not very important, but just an observation: I would remove the calls _setupDomainUse part and just keep the changes the function that is used to call callbacks.... The reason is that that much details is not needed, and it would make the comment depend too much on implementation.

@misterdjules
Copy link

I would personally rephrase it to something like:

// Requiring the domain module here changes the function that is used by node to call
// process.nextTick's callbacks to a variant that specifically handles domains. We want
// to test this specific variant in this test, and so even if the domain module is not used,
// this require call is needed and must not be removed.
require('domain')

It depends a bit less on implementation details while still being explicit and clear. But I'm also fine with the existing comments, as long as the typo that I mentioned in an inline comment is fixed.

@Trott
Copy link
Member Author

Trott commented Dec 31, 2015

@misterdjules Updated with your definitely-better suggested text. Thanks.

CI: https://ci.nodejs.org/job/node-test-pull-request/1126/

@misterdjules
Copy link

The two commits will need to be squashed into one. The commit message can probably be shorter and just mention that a comment was added to make the purpose of these tests clearer. I don't think we need to quote the whole comment.

Other than that, LGTM. Thank you very much for doing that!

Add a comment to clarify how the tests work and their purpose.

Also removes unnecessary assignment of domain module to a variable.

PR-URL: nodejs#4474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
Trott added a commit to Trott/io.js that referenced this pull request Jan 2, 2016
Add a comment to clarify how the tests work and their purpose.

Also removes unnecessary assignment of domain module to a variable.

PR-URL: nodejs#4474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
@Trott
Copy link
Member Author

Trott commented Jan 2, 2016

Landed in b16a50d

@Trott Trott closed this Jan 2, 2016
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request Jan 6, 2016
Add a comment to clarify how the tests work and their purpose.

Also removes unnecessary assignment of domain module to a variable.

PR-URL: nodejs#4474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
MylesBorins pushed a commit that referenced this pull request Jan 13, 2016
Add a comment to clarify how the tests work and their purpose.

Also removes unnecessary assignment of domain module to a variable.

PR-URL: #4474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
Add a comment to clarify how the tests work and their purpose.

Also removes unnecessary assignment of domain module to a variable.

PR-URL: #4474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
@MylesBorins MylesBorins mentioned this pull request Jan 19, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
Add a comment to clarify how the tests work and their purpose.

Also removes unnecessary assignment of domain module to a variable.

PR-URL: nodejs#4474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julien Gilli <jgilli@fastmail.fm>
@Trott Trott deleted the rm-borked-tests branch January 13, 2022 22:31
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants