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

doc: Recommend using port 0 instead of common.PORT #8694

Closed
wants to merge 3 commits into from

Conversation

niklasi
Copy link
Contributor

@niklasi niklasi commented Sep 21, 2016

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

In the writing_tests guide it is recommended to use common.PORT
instead of an arbitrary value, but the recommendation is to use
port 0 instead and the docs should reflect that.

In the 'writing_tests' guide it is recommended to use common.PORT
instead of an arbitrary value, but the recommendation is to use
port 0 instead and the docs should reflect that.
@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Sep 21, 2016
@lpinca
Copy link
Member

lpinca commented Sep 21, 2016

You beat me to it, was a couple of minute away from sending a PR for this, thanks!

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM

using.
- The use of 0 as the listening port. Always use 0 instead of using an
arbitrary value, as it allows to run tests in parallel safely, as the
operating system will assign a random port.
Copy link
Member

Choose a reason for hiding this comment

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

We could add something explaining that this is true, unless the test is specifically checking that assigning a specific port works as expected.

Copy link
Member

@santigimeno santigimeno left a comment

Choose a reason for hiding this comment

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

LGTM with a suggestion

@gibfahn
Copy link
Member

gibfahn commented Sep 21, 2016

LGTM with @santigimeno's suggestion.

@imyller
Copy link
Member

imyller commented Sep 21, 2016

For example test being modified in PR #8586 is exception to this. As @santigimeno pointed out, some tests need to test assigning specific port.

Copy link
Member

@imyller imyller left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

LGTM

@santigimeno santigimeno added the test Issues and PRs related to the tests. label Sep 21, 2016
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.

Left a nit comment, but LGTM with or without that comment addressed.

instead of using an arbitrary value, as it allows to run tests in parallel
safely, as they are not trying to reuse the same port another test is already
using.
- The use of 0 as the listening port. Always use 0 instead of using an
Copy link
Member

Choose a reason for hiding this comment

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

NIt: The first sentence isn't really necessary. This paragraph can start with Always use...

@Trott
Copy link
Member

Trott commented Sep 21, 2016

(Also: I agree with @santigimeno's comment!)

@mhdawson
Copy link
Member

LGTM subject to comments already made.

arbitrary value, as it allows to run tests in parallel safely, as the
operating system will assign a random port.
- If the test doesn't depend on a specific port number then always use 0 instead
of an arbitrary value, as it allows to run tests in parallel safely, as the
Copy link
Contributor

Choose a reason for hiding this comment

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

as it allows tests to be run in parallel safely reads a little bit cleaner I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

of an arbitrary value, as it allows to run tests in parallel safely, as the
operating system will assign a random port. If the test requires a specific
port, for example if the test checks that assigning a specific port works as
expected, then it is ok to assign a specific port number.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we suggest using common.PORT in any cases?

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM with a few comments.

@Fishrock123
Copy link
Contributor

Could someone provide some background on this? I'm a little confused about it. Should we get rid of common.PORT? Isn't it used to ensure the tests can be run in parallel?

@santigimeno
Copy link
Member

Could someone provide some background on this? I'm a little confused about it. Should we get rid of common.PORT? Isn't it used to ensure the tests can be run in parallel?

It was used to ensure that, but it was failing to do so. Sometimes a test would crash and the port would remain in use, causing EADDRINUSE issues. Using port 0, the OS selects an unused port avoiding any trouble.
I don't think we should get rid of common.PORT as sometimes you want to test that assigning a specific port works as expected.

@lpinca
Copy link
Member

lpinca commented Oct 1, 2016

Is there anything left to do here? Apart from @cjihrig's comment everything seems to be addressed.

@Trott
Copy link
Member

Trott commented Oct 1, 2016

Is there anything left to do here? Apart from @cjihrig's comment everything seems to be addressed.

I think this can be landed. I have some nits. (The first sentence in the paragraph that's added is a bit of a run-on sentence. Split it into two sentences, maybe? And the last sentence in the paragraph should probably mention common.PORT specifically.) But those can be addressed later (or not at all). The current state of this PR is an improvement over the current state of the document, so LGTM.

@imyller imyller self-assigned this Oct 3, 2016
@imyller
Copy link
Member

imyller commented Oct 3, 2016

Landing:

  • Approvals (LGTM): 8
  • No objections
  • PR has been open for the minimum time of 48 or 72 hours
  • All of the requested (mandatory) changes have been made

imyller pushed a commit to imyller/node that referenced this pull request Oct 3, 2016
In the 'writing_tests' guide it is recommended to use common.PORT
instead of an arbitrary value, but the recommendation is to use
port 0 instead and the docs should reflect that.

PR-URL: nodejs#8694
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@imyller
Copy link
Member

imyller commented Oct 3, 2016

Landed in 3326081

Thank you for your effort and contribution, @niklasi

@imyller imyller closed this Oct 3, 2016
@imyller imyller removed their assignment Oct 3, 2016
jasnell pushed a commit that referenced this pull request Oct 6, 2016
In the 'writing_tests' guide it is recommended to use common.PORT
instead of an arbitrary value, but the recommendation is to use
port 0 instead and the docs should reflect that.

PR-URL: #8694
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
In the 'writing_tests' guide it is recommended to use common.PORT
instead of an arbitrary value, but the recommendation is to use
port 0 instead and the docs should reflect that.

PR-URL: #8694
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.