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: replace common.fixturesDir with common.fixtures module #15810

Closed

Conversation

kasimdoctor
Copy link

@kasimdoctor kasimdoctor commented Oct 6, 2017

Action-> Replaced common.fixturesDir in test-tls-key-mismatch.js with common.fixtures module

Pushed as part of Node.js Interactive 2017 Code n Learn!

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

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 6, 2017
@@ -32,8 +33,8 @@ const errorMessageRegex =
/^Error: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch$/;

const options = {
key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`),
cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
key: fs.readFileSync(`${fixtures.fixturesDir}/keys/agent1-key.pem`),
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be using method fixtures.readKey instead of fs.readFileSync to get the keys.

Copy link
Author

Choose a reason for hiding this comment

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

@pawelgolda Sure, but fixtures.readKey also requires an enc, not sure what to pass in there 🤔

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 leave that param out empty.

Copy link
Author

Choose a reason for hiding this comment

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

Nevermind, I see from the documentation that enc is indeed optional, so I will actually go ahead and make that change.

Copy link
Author

Choose a reason for hiding this comment

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

@pawelgolda Doing that change breaks the test for some reason..

Copy link
Contributor

Choose a reason for hiding this comment

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

@kasimdoctor Can you post the code?

Copy link
Member

Choose a reason for hiding this comment

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

It should definitely just be...

key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')

Copy link
Author

Choose a reason for hiding this comment

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

@jasnell I get the following error when running the test with the code change you requested:

=== release test-tls-key-mismatch ===
Path: parallel/test-tls-key-mismatch
assert.js:45
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: Missing expected exception.
    at innerThrows (assert.js:683:7)
    at Function.throws (assert.js:702:3)
    at Object.<anonymous> (/src/repos/personal/node/test/parallel/test-tls-key-mismatch.js:41:8)
    at Module._compile (module.js:599:30)
    at Object.Module._extensions..js (module.js:610:10)
    at Module.load (module.js:518:32)
    at tryModuleLoad (module.js:481:12)
    at Function.Module._load (module.js:473:3)
    at Function.Module.runMain (module.js:640:10)
    at startup (bootstrap_node.js:187:16)
Command: out/Release/node /src/repos/personal/node/test/parallel/test-tls-key-mismatch.js

Copy link
Member

Choose a reason for hiding this comment

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

@kasimdoctor make sure to use 'agent2-cert.pem' for the cert.

Copy link
Author

Choose a reason for hiding this comment

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

@lpinca Thanks! That was a dumb mistake on my part 😄

@mscdex mscdex added the tls Issues and PRs related to the tls subsystem. label Oct 6, 2017
@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 6, 2017
@@ -21,6 +21,7 @@

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: can you please move this after the common.hasCrypto check?

@kasimdoctor
Copy link
Author

@jasnell @pawelgolda @lpinca Comments addressed. Please have a look again. Thanks!

@lpinca
Copy link
Member

lpinca commented Oct 15, 2017

@kasimdoctor
Copy link
Author

CI is green!

gireeshpunathil pushed a commit that referenced this pull request Oct 16, 2017
PR-URL: #15810
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
@gireeshpunathil
Copy link
Member

#git rev-list upstream/master...HEAD | xargs core-validate-commit
     ✔  006fdb2fe5d9d1681f25c44009242304740ce154
     ✔  0:0      skipping fixes-url                        fixes-url
     ✔  0:0      blank line after title                    line-after-title
     ✔  0:0      line-lengths are valid                    line-length
     ✔  0:0      metadata is at end of message             metadata-end
     ✔  0:0      reviewers are valid                       reviewers
     ✔  0:0      valid subsystems                          subsystem
     ✔  0:0      Title is <= 50 columns.                   title-length
#

@gireeshpunathil
Copy link
Member

Landed in 006fdb2 . Thanks for the contribution!

@kasimdoctor kasimdoctor deleted the test-tls-key-mismatch-fix branch October 16, 2017 13:47
targos pushed a commit that referenced this pull request Oct 18, 2017
PR-URL: #15810
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 18, 2017
PR-URL: nodejs/node#15810
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 16, 2017
PR-URL: #15810
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Nov 21, 2017
MylesBorins pushed a commit that referenced this pull request Nov 21, 2017
PR-URL: #15810
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 28, 2017
PR-URL: #15810
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
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.

10 participants