Skip to content

Commit

Permalink
test: set clientOpts.port property
Browse files Browse the repository at this point in the history
Currently this test will overwrite the clientOpts object with the port,
instead of setting the port property on the clientOpts object which
looks like the original intent.

Doing this the test fails reporting that the fake-cnnic-root-cert has
expired. This is indeed true:
$ openssl x509 -in test/fixtures/keys/fake-cnnic-root-cert.pem \
-text -noout
Certificate:
        ...
        Validity
            Not Before: Jun  9 17:15:16 2015 GMT
            Not After : Mar 29 17:15:16 2018 GMT

This commit sets the errorCode to CERT_HAS_EXPIRED. I tried updating the
certificate using test/fixtures/keys/Makefile but then no error is
thrown and I'm currently looking into this.

Backport-PR-URL: #20776
PR-URL: #19767
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
danbev authored and rvagg committed Aug 16, 2018
1 parent 98f5b17 commit 64b4ea4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-tls-cnnic-whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const testCases = [
rejectUnauthorized: true,
ca: [loadPEM('fake-cnnic-root-cert')]
},
errorCode: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
errorCode: 'CERT_HAS_EXPIRED'
},
// Test 1: for the fix of node#2061
// agent6-cert.pem is signed by intermediate cert of ca3.
Expand Down Expand Up @@ -58,7 +58,7 @@ function runTest(tindex) {
const server = tls.createServer(tcase.serverOpts, (s) => {
s.resume();
}).listen(0, common.mustCall(function() {
tcase.clientOpts = this.address().port;
tcase.clientOpts.port = this.address().port;
const client = tls.connect(tcase.clientOpts);
client.on('error', common.mustCall((e) => {
assert.strictEqual(e.code, tcase.errorCode);
Expand Down

0 comments on commit 64b4ea4

Please sign in to comment.