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: refactor and deflake test-tls-sni-server-client #27426

Closed

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Apr 26, 2019

  • Run all tests in parallel.
  • Move socket.end() call to client.
  • Use common.mustCall() and common.mustNotCall().

Fixes: #27219
Refs: #27300

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Apr 26, 2019
@lpinca lpinca requested a review from sam-github April 26, 2019 14:27
const fixtures = require('../common/fixtures');
const { strictEqual } = require('assert');
const { connect, createServer } = require('tls');
const { readKey } = require('../common/fixtures');
Copy link
Member

@Trott Trott May 1, 2019

Choose a reason for hiding this comment

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

Not blocking, but why the mass-introduction of destructuring? To me, it makes the subsequent code harder to understand. Later on, if I see fixtures.readKey(), I know exactly what that means. But if I just see readKey()...I'm less sure. Doubly so for connect() on the line above.

Again, not blocking because it's ultimately a style choice, but I'm genuinely curious if there's a motivation/advantage I'm not seeing that I should be seeing.

Copy link
Member Author

@lpinca lpinca May 1, 2019

Choose a reason for hiding this comment

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

No particular reason, in most cases it is obvious and shorter. For example assert.strictEqual why not only strictEqual and the same for createServer, mustCall, mustNotCall. The others are for consistency.

I will revert this to make the diff smaller.

Copy link
Contributor

Choose a reason for hiding this comment

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

When I was working in python (which js's import syntax seems to be modelled on), we forbade this usage in our coding standards. Functions were always called with their leading module name, tls.connect not connect (which could be net.connect). We found it makes code harder to understand when we couldn't see where a function came from. It seems to me that the js community, or perhaps node, is going the opposite way. Its a stylistic choice, I don't feel strongly enough about it to try to change it, but I'm in agreement with @Trott that eliding the module name makes subsequent code harder to read.

Copy link
Member Author

@lpinca lpinca May 1, 2019

Choose a reason for hiding this comment

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

I partially agree but it in my opinion it depends. On a large file it makes sense. When there are just few lines of code, it's easy to see where it's coming from.

One thing is for sure though, I don't like to mix things, so it's always or never for me :)

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.

LGTM despite my style question/quibble.

@Trott
Copy link
Member

Trott commented May 1, 2019

(Needs a rebase.)

- Run all tests in parallel.
- Move `socket.end()` call to client.
- Use `common.mustCall()` and `common.mustNotCall()`.

Fixes: nodejs#27219
Refs: nodejs#27300
@lpinca lpinca force-pushed the deflake/test-tls-sni-server-client branch from e61b13c to 8d63f4c Compare May 1, 2019 06:02
@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented May 2, 2019

Landed in bc0a330

@Trott Trott closed this May 2, 2019
Trott pushed a commit to Trott/io.js that referenced this pull request May 2, 2019
- Run all tests in parallel.
- Move `socket.end()` call to client.
- Use `common.mustCall()` and `common.mustNotCall()`.

Fixes: nodejs#27219
Refs: nodejs#27300

PR-URL: nodejs#27426
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@lpinca lpinca deleted the deflake/test-tls-sni-server-client branch May 4, 2019 07:44
targos pushed a commit that referenced this pull request May 4, 2019
- Run all tests in parallel.
- Move `socket.end()` call to client.
- Use `common.mustCall()` and `common.mustNotCall()`.

Fixes: #27219
Refs: #27300

PR-URL: #27426
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@targos targos mentioned this pull request May 6, 2019
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.

Investigate flaky parallel/test-tls-sni-server-client
4 participants