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: check for error on Windows #2035

Closed
wants to merge 1 commit into from
Closed

Conversation

Trott
Copy link
Member

@Trott Trott commented Jun 23, 2015

Instead of not running the dgram-bind-shared-ports
on Windows, check that it gets ENOTSUP.

CI: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/70/

@Trott Trott added dgram Issues and PRs related to the dgram subsystem / UDP. test Issues and PRs related to the tests. labels Jun 23, 2015
@brendanashworth brendanashworth added the windows Issues and PRs related to the Windows platform. label Jun 23, 2015

function noop() {}

if (cluster.isMaster) {
var worker1 = cluster.fork();

if (isWindows) {
worker1.on('error', function(er) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe wrap the callback in common.mustCall(...)?

@bnoordhuis
Copy link
Member

LGTM with a suggestion. Can you remove the console.log statements?

// test
if (process.platform == 'win32')
process.exit(0);
var isWindows = process.platform === 'win32';
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use common.isWindows here.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 23, 2015

I agree about the console.log()s. They can be useful when a test fails and you're looking at the output, but two generic oks aren't very helpful.

Instead of not running the dgram-bind-shared-ports
on Windows, check that it gets ENOTSUP.
@Trott
Copy link
Member Author

Trott commented Jun 23, 2015

Per feedback from @bnoordhuis and @cjihrig:

  • Use common.isWindows rather than rolling my own
  • Use common.mustCall() to insure callback gets called exactly once
  • Remove less-than-informative console.log() messages

New CI: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/71/

@Trott
Copy link
Member Author

Trott commented Jun 23, 2015

Yet another CI to confirm that the smartOS failure was a flaky test and not something in this PR:

https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/72/

@cjihrig
Copy link
Contributor

cjihrig commented Jun 23, 2015

Yea, this PR only changes a test, so unless test-dgram-bind-shared-ports.js fails, it's most likely unrelated. LGTM if the CI is happy.

worker1.kill();
};

worker1.on('error', common.mustCall(checkErrType, 1));
Copy link
Member

Choose a reason for hiding this comment

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

1 is the default, you can just write it as worker1.on('error', common.mustCall(function(err) { (although it's not wrong this way.)

@bnoordhuis
Copy link
Member

LGTM

@Trott
Copy link
Member Author

Trott commented Jun 23, 2015

Third time is the charm on the CI run. All green: https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/73/

Trott added a commit that referenced this pull request Jun 25, 2015
Instead of not running the dgram-bind-shared-ports
on Windows, check that it gets ENOTSUP.

PR-URL: #2035
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott
Copy link
Member Author

Trott commented Jun 25, 2015

Merged in 8e9089a

@Trott Trott closed this Jun 25, 2015
@rvagg rvagg mentioned this pull request Jun 30, 2015
mscdex pushed a commit to mscdex/io.js that referenced this pull request Jul 9, 2015
Instead of not running the dgram-bind-shared-ports
on Windows, check that it gets ENOTSUP.

PR-URL: nodejs#2035
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott Trott deleted the dgram-windows branch January 9, 2022 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dgram Issues and PRs related to the dgram subsystem / UDP. test Issues and PRs related to the tests. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants