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: refactors test-tls-client-verify #10051

Closed
wants to merge 1 commit into from
Closed

test: refactors test-tls-client-verify #10051

wants to merge 1 commit into from

Conversation

homosaur
Copy link
Contributor

@homosaur homosaur commented Dec 1, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Refactor of test-tls-client-verify for NINA Code and Learn

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@imyller imyller added code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. tls Issues and PRs related to the tls subsystem. labels Dec 1, 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.

Thanks for the contribution! The common.mustCall() stuff can be a bit tricky the first time one comes across it. I think this isn't quite correct.

If you want to isolate it, feel free to pull it out of this PR (just leaving the const and strictEqual() stuff) and put it in another PR where it can be discussed in isolation.

Or if you feel like you have a good handle on it, go for fixing it here!

And if you're totally confused, feel free to hit me up (or anyone else, really) in email or IRC or Slack or whatever.

if (!tcase) return;
const tcase = testCases[testIndex];
if (!tcase) {
common.mustCall(function() {
Copy link
Member

@Trott Trott Dec 5, 2016

Choose a reason for hiding this comment

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

This doesn't look right. If you put common.mustCall() inside a conditional, then the function won't be required to be called unless the conditional is true. But this is an immediately-invoked function, so the common.mustCall() seemingly serves no purpose here. Maybe what is meant is for thisMustRunOnce = common.mustCall(function() {...}); to be outside the conditional and then inside the conditional: thisMustRunOnce().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the detailed feedback @Trott, it is very appreciated. Specifically, the final request was to refactor the process.exit into a common.mustCall instead. I see how it doesn't make sense to have it inside the conditional. Would it be better to revert the final task back to using the process.exit call, simply remove the mustCall from the conditional, or to refactor as a function using mustCall outside the conditional as suggested?

I read through the code for mustCall and I understand what it's doing, I'm just not 100% certain I fully grok the intention of its usage in testing. Thanks!

Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions
@homosaur
Copy link
Contributor Author

homosaur commented Dec 7, 2016

@Trott, I reverted the final refactor of process.exit to the mustCall pattern (for now) and changed the commit message accordingly. Thanks for the help on it.

@Trott
Copy link
Member

Trott commented Dec 7, 2016

LGTM if CI is ✅

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

@Trott
Copy link
Member

Trott commented Dec 7, 2016

@addaleax
Copy link
Member

addaleax commented Dec 8, 2016

Landed in fd6999e, thanks for the contribution!

@addaleax addaleax closed this Dec 8, 2016
addaleax pushed a commit that referenced this pull request Dec 8, 2016
Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions

PR-URL: #10051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax pushed a commit that referenced this pull request Dec 8, 2016
Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions

PR-URL: #10051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax pushed a commit to addaleax/node that referenced this pull request Dec 8, 2016
Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions

PR-URL: nodejs#10051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@italoacasas italoacasas mentioned this pull request Dec 15, 2016
MylesBorins pushed a commit that referenced this pull request Dec 20, 2016
Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions

PR-URL: #10051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Dec 21, 2016
Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions

PR-URL: #10051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins pushed a commit that referenced this pull request Dec 21, 2016
Swaps var -> const/let
assert.equal becomes assert.strictEqual
common.mustCall on single-use functions

PR-URL: #10051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This was referenced Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. test Issues and PRs related to the tests. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants