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: fix crypto test case to use correct encoding #17956

Closed

Conversation

tniessen
Copy link
Member

@tniessen tniessen commented Jan 2, 2018

The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case.

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)

The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jan 2, 2018
@tniessen tniessen added the fast-track PRs that do not need to wait for 48 hours to land. label Jan 2, 2018
@cjihrig
Copy link
Contributor

cjihrig commented Jan 2, 2018

The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case.

Can the error message check be improved so that the test only passes with the correct error?

@tniessen
Copy link
Member Author

tniessen commented Jan 2, 2018

The callback would have errored out anyway due to the incorrect encoding, and that error is not the point of this test case.

Can the error message check be improved so that the test only passes with the correct error?

It already does not pass, but there is no reason to intentionally use an incorrect encoding here. If we really want to pass an invalid encoding, we should at least add a comment. To me, it was not obvious why the test failed with the message [ERR_ASSERTION]: Cannot change encoding when authentication passed.

@tniessen
Copy link
Member Author

tniessen commented Jan 2, 2018

@@ -389,7 +389,7 @@ for (const test of TEST_CASES) {
assert.strictEqual(msg, test.plain);
} else {
// assert that final throws if input data could not be verified!
assert.throws(function() { decrypt.final('ascii'); }, errMessages.auth);
assert.throws(() => decrypt.final('hex'), errMessages.auth);
Copy link
Member

Choose a reason for hiding this comment

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

Micro-nit: I'd prefer we keep braces around this arrow function because it makes it clear that we're not intending to return a value here. Totally ignore me if you have strong opinions to the contrary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thank you.

@tniessen
Copy link
Member Author

tniessen commented Jan 4, 2018

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 5, 2018
@BridgeAR
Copy link
Member

BridgeAR commented Jan 5, 2018

Landed in 5160dd0

@BridgeAR BridgeAR closed this Jan 5, 2018
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 5, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: nodejs#17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Jan 8, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Jan 10, 2018
@TimothyGu TimothyGu removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 13, 2018
MylesBorins pushed a commit that referenced this pull request Jan 24, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2018
MylesBorins pushed a commit that referenced this pull request Feb 11, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Feb 12, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Feb 13, 2018
The callback would have errored out anyway due to the incorrect
encoding, and that error is not the point of this test case.

PR-URL: #17956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track PRs that do not need to wait for 48 hours to land. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants