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: Updated tls-getcipher test #9923

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions test/parallel/test-tls-getcipher.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
'use strict';
var common = require('../common');
var assert = require('assert');
const common = require('../common');
const assert = require('assert');
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 require after the hasCrypto check?


if (!common.hasCrypto) {
common.skip('missing crypto');
return;
}
var tls = require('tls');
const tls = require('tls');

var fs = require('fs');
var cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
var cipher_version_pattern = /TLS|SSL/;
var options = {
const fs = require('fs');
const cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
const cipher_version_pattern = /TLS|SSL/;
const options = {
key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
ciphers: cipher_list.join(':'),
honorCipherOrder: true
};

var server = tls.createServer(options,
const server = tls.createServer(options,
common.mustCall(function(cleartextStream) {}));
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be lined up now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by lined up? Sorry, still new to this!

Copy link
Member

Choose a reason for hiding this comment

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

@Ethan-Arrowood The argument (common.mustCall...)on line 22 should line up with the argument on line 21 (options). So line 22 needs to be indented two more spaces. I'm surprised this isn't caught by the linter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I went ahead and fixed that issue and made another commit


server.listen(0, '127.0.0.1', function() {
var client = tls.connect({
server.listen(0, '127.0.0.1', common.mustCall(function() {
const client = tls.connect({
host: '127.0.0.1',
port: this.address().port,
ciphers: cipher_list.join(':'),
rejectUnauthorized: false
}, function() {
var cipher = client.getCipher();
assert.equal(cipher.name, cipher_list[0]);
}, common.mustCall(function() {
const cipher = client.getCipher();
assert.strictEqual(cipher.name, cipher_list[0]);
assert(cipher_version_pattern.test(cipher.version));
client.end();
server.close();
});
});
}));
}));