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: simplify loadDHParam in TLS test #18103

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 1 addition & 4 deletions test/parallel/test-tls-client-getephemeralkeyinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const fixtures = require('../common/fixtures');

const assert = require('assert');
const tls = require('tls');
const fs = require('fs');

const key = fixtures.readKey('agent2-key.pem');
const cert = fixtures.readKey('agent2-cert.pem');
Expand All @@ -15,9 +14,7 @@ let ntests = 0;
let nsuccess = 0;

function loadDHParam(n) {
let path = fixtures.fixturesDir;
if (n !== 'error') path += '/keys';
return fs.readFileSync(`${path}/dh${n}.pem`);
return fixtures.readKey(`dh${n}.pem`);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: it can also be inlined at this point. Ignore this comment if it is more readable in this way.

Copy link
Member Author

@tniessen tniessen Jan 11, 2018

Choose a reason for hiding this comment

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

I considered it but then decided to keep it this way as test-tls-dhe.js declares the same function with additional logic to handle the error case. I can still remove it if you would like.

Copy link
Member

Choose a reason for hiding this comment

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

test-tls-dhe.js, ok it makes sense, it's really a nuance.

}

const cipherlist = {
Expand Down
5 changes: 1 addition & 4 deletions test/parallel/test-tls-client-mindhsize.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ let nsuccess = 0;
let nerror = 0;

function loadDHParam(n) {
const params = [`dh${n}.pem`];
if (n !== 'error')
params.unshift('keys');
return fixtures.readSync(params);
return fixtures.readKey(`dh${n}.pem`);
}

function test(size, err, next) {
Expand Down