-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: make tests pass when configured --without-ssl #11631
Conversation
abdc101
to
b81bdb2
Compare
Rebased and new CI: https://ci.nodejs.org/job/node-test-pull-request/6651/ |
parallel/test-https-agent-create-connection is failing on the centos5-32 and win2008r2 buildbots with this PR but not others. EDIT: Although, see #11644 - almost too much of a coincidence. |
test/fixtures/tls-connect.js
Outdated
@@ -19,6 +22,7 @@ function checkCrypto() { | |||
return exports; | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace change.
test/testpy/__init__.py
Outdated
# The following block reads config.gypi to extract the v8_enable_inspector | ||
# value. This is done to check if the inspector is disabled in which case | ||
# the '--inspect' flag cannot be passed to the node process as it will | ||
# that will cause node to exit and report the test as failed. The use case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"it will that will"
'sources': ['binding.cc'], | ||
'include_dirs': ['../../../deps/openssl/openssl/include'], | ||
}] | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of surprised this works. gyp generally doesn't like it when there are no source files to compile.
test/fixtures/tls-connect.js
Outdated
@@ -6,6 +6,9 @@ | |||
const common = require('../common'); | |||
const fs = require('fs'); | |||
const join = require('path').join; | |||
// Check if Node was compiled --without-ssl and if so exit early | |||
// as the require of tls will otherwise throw an Error. | |||
checkCrypto(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix up the tests that include this file? They call this function too but that's unnecessary with this change. You can probably stop exporting checkCrypto() altogether and just inline it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, missed that. I'll fix that.
test/testpy/__init__.py
Outdated
if flag[0].startswith('--inspect') and v8_disable_inspector: | ||
print('Skipping as inspector is disabled') | ||
else: | ||
result += flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this run once per run or once per test? The latter would be a little wasteful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually once per test which is wasteful as you say. I'll take a look at how this can be run only once.
@@ -1,6 +1,10 @@ | |||
'use strict'; | |||
|
|||
const common = require('../../common'); | |||
if (!common.hasCrypto) { | |||
common.skip('missing crypto'); | |||
process.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing uses of common.skip()
in other tests return
afterwards rather than calll process.exit()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take another look at this. Just returning does not work in this case but I'll try and dig a little further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I don't think we can just return as that would cause the tests that require tls-connect
should not be able to proceed if there is no crypto. There might be other/better ways to deal with this but perhaps that should be done as a separate PR in that case.
c47e103
to
e648edb
Compare
Currently when node is build --without-ssl and the test are run, the test that use the tls-connect fixture will throw an Error saying that Node was not built with ssl support. The error is thrown when the tls module is required causing the test that use it to fail unstead of being skipped when there is no ssl support to test. This commit calls checkCrypto before requiring the tls module so that an error is not thrown and the test skipped instead.
This commit enables the test-parallel target to pass when the build is configured --without-ssl To configure and run: $ ./configure --without-ssl --debug && make -j8 test-parallel The update to test/testspy/__init__.py is for test-cluster-inspector-debug-port.js which passes '--inspect={PORT} flag to the node process which causes the process to exit as the inspector is not enabled when ssl is disabled. The suggested solution here is to simply remove the flag when v8_enable_inspector is 0 and then have a check in the test like the others test in this commit.
Add checks to the compilation of this addon and also a check when the test is run to see if ssl is enabled or not. If it is not enabled then skip this test.
e648edb
to
b440006
Compare
Rebased and triggered another CI: https://ci.nodejs.org/job/node-test-pull-request/6675/ |
@bnoordhuis Would you mind taking a look at the lastest commits which attempt to address your review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if you update the remaining test files. Nice work.
test/fixtures/tls-connect.js
Outdated
return exports; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this if you update the files that include this file:
$ git grep -n tls-connect test/
test/parallel/test-tls-addca.js:11:} = require(join(common.fixturesDir, 'tls-connect'))();
test/parallel/test-tls-ca-concat.js:10:} = require(join(common.fixturesDir, 'tls-connect'))();
test/parallel/test-tls-cert-chains-concat.js:10:} = require(join(common.fixturesDir, 'tls-connect'))();
test/parallel/test-tls-cert-chains-in-ca.js:10:} = require(join(common.fixturesDir, 'tls-connect'))();
test/parallel/test-tls-connect-secure-context.js:9:} = require(join(common.fixturesDir, 'tls-connect'))();
test/parallel/test-tls-peer-certificate.js:9:} = require(join(common.fixturesDir, 'tls-connect'))();
test/parallel/test-tls-socket-default-options.js:10:} = require(join(common.fixturesDir, 'tls-connect'));
Simply remove the ()
at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah great, was not sure I was "allowed" to do that :) Thanks for the review!
Currently when node is build --without-ssl and the test are run, there are a number of failing test due to tests expecting crypto support to be available. This commit fixes fixes the failure and instead skips the tests that expect crypto to be available. PR-URL: nodejs#11631 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Landed in 1402fef |
This doesn't appear to work properly when cherry-picked to v7.x-staging. This is the error I am getting when trying to run
Mind opening a backport PR? |
Currently when node is build --without-ssl and the test are run, there are a number of failing test due to tests expecting crypto support to be available. This commit fixes fixes the failure and instead skips the tests that expect crypto to be available. PR-URL: nodejs#11631 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Should this be backported to |
Probably makes sense to backport #12485 in the same PR. |
Also #12882 (and any other later ones that use |
@gibfahn Sorry about not replying to the backporting issues/requests. I'm not ignoring them, I'm just a little swamped this week and hope to take a closer look at them next week. |
@danbev there's no rush! If it misses the windows for this release you might have to rebase before the next one, but otherwise it doesn't make a big difference. If something really needs to be backported I'll let you know. |
I've backported |
If we backport the rest of this to v6.x we should include #16621 |
This pull request contains a number of commits to enable the tests to pass when having configured node using
--without-ssl
. For example:Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test