Skip to content

test: fix test failure with shared openssl #762

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

shigeki
Copy link
Contributor

@shigeki shigeki commented Feb 9, 2015

When configured with share openssl, use external openssl command and check if it can be executed.

Fixes: #618

Cc: @jbergstroem

Please someone in @iojs/collaborators review this.

@shigeki shigeki added the tls Issues and PRs related to the tls subsystem. label Feb 9, 2015
// use external command
exports.opensslCli = 'openssl';
} else {
// use build-in command
Copy link
Contributor

Choose a reason for hiding this comment

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

kind of very irrelevant, but built-in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brendanashworth Do you have a proper word? I think of others such as bundled or included command in iojs or to delete this comment.

Copy link
Member

Choose a reason for hiding this comment

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

built-in sounds good to me

@jbergstroem
Copy link
Member

The openssl binary is now properly called. Minor language nits, but lgtm.

try {
fs.accessSync(exports.opensslCli);
} catch (err) {
var openssl_cmd = child_process.spawnSync(exports.opensslCli, ['version']);
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, this only runs when the openssl binary is actually needed. Spawning a child process adds a few milliseconds to each test; multiplied by ~600 tests, that's a couple of extra seconds. Maybe you can turn the .opensslCli property into a lazy getter?

@shigeki
Copy link
Contributor Author

shigeki commented Feb 9, 2015

@bnoordhuis Thanks for your review. Indeed, opensslCli needs to be called lazily. I've just update as shigeki@a3055e6 with a style revised. PTAL. I will squash it after your review.

var opensslCli = null;


function opensslCliGetter() {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a if (opensslCli !== null) return opensslCli; at the top? Avoids multiple invocations of the openssl binary.

EDIT: Never mind, I see you're doing that below. Just curious: is there a reason to split the logic into two functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bnoordhuis Splitting is just for easy to read and notify this is a getter function. I don't mind to change it into inline.

Copy link
Member

Choose a reason for hiding this comment

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

Inline is a little easier to comprehend when you read the code top-down.

@bnoordhuis
Copy link
Member

LGTM with a question.

When configured with share openssl, use external openssl command and
check if it can be executed.

Fixes: nodejs#618
shigeki pushed a commit that referenced this pull request Feb 9, 2015
When configured with share openssl, use external openssl command and
check if it can be executed.

Fixes: #618
PR-URL: #762
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@shigeki
Copy link
Contributor Author

shigeki commented Feb 9, 2015

@bnoordhuis Changed this into inline and landed c86e383 . Thanks

@shigeki
Copy link
Contributor Author

shigeki commented Feb 9, 2015

@brendanashworth The comment was revised more clearly as c86e383#diff-8736c5cbff21e1dee18b0c86d3d2689dR32 according your review. Thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants