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

Crypto tests overhaul #1049

Closed
wants to merge 6 commits into from

Conversation

jbergstroem
Copy link
Member

So, based on the situation we introduced in #1035 (someone actually running tests with ./configure --without-ssl), I rewrote the way we look for crypto/tls/https support.

A few things:

  1. Introduce a helper in common.js that checks for process.versions.openssl. This could potentially be changed to try importing crypto instead.
  2. Review all tests that fail (and the one's that imported tls, https or crypto) to use the new check
  3. Unify tests that had their own way of checking for various types of crypto support
  4. Have a few tests do partial runs (one or two) -- for instance tests that checks both against http and https servers. These should probably be moved out to their own tests
  5. Fix fallout found in for instance testing process.versions (my bad)
  6. Avoid style/lint changes as much as possible, but update two tests (2a4a51d) that broke because they imported https while not using it.

Since this affects a lot of files I'd appreciate a quicker feedback round; can see myself rebasing this a fair few times otherwise.

@rvagg
Copy link
Member

rvagg commented Mar 4, 2015

since this applies to tls and https (among other things), it'll be used
for those tests as well. if we decouple the build system to somehow support
crypto but not tls, we could refine this.
the previous version checked if io.js was compiled with openssl support which
isn't really relevant since we're starting a http server. we on the other hand
need an openssl-cli which may or may not exist.
@jbergstroem
Copy link
Member Author

(changed some commit message texts)

@jbergstroem
Copy link
Member Author

/cc @brendanashworth @shigeki

@bnoordhuis
Copy link
Member

Left some comments. Perhaps it'd be nice to make the skip message TAP-compatible, i.e. console.log('# SKIP skipping, no crypto')

@jbergstroem
Copy link
Member Author

@bnoordhuis Thanks for the feedback. I'll revise shortly. While going through a bunch of tests, I came to realise there's a fair few things to clean up and improve.

With regards to your syntax suggestion, how about doing a helper for skip (and possibly exit) which is configurable so we more easily can control output? I guess its out of scope for this PR, but it could come shortly thereafter.

@bnoordhuis
Copy link
Member

With regards to your syntax suggestion, how about doing a helper for skip (and possibly exit) which is configurable so we more easily can control output?

Virtual shrug. Is there a need for it?

@jbergstroem
Copy link
Member Author

@bnoordhuis just updated, fixing your remarks. I also split the https part of test-http-host-header into its own test. I left buffer alone for now.

As for the helper: we could control skip output type so different test runner understands them. No strong argument though, tap is readable enough.

@jbergstroem
Copy link
Member Author

Just added tap output (output suggested here).

crypto.createHash('sha1').update(b1).digest('hex'),
crypto.createHash('sha1').update(b2).digest('hex')
);
if(common.hasCrypto) {
Copy link
Contributor

Choose a reason for hiding this comment

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

styles: Missing space before "(". There are the same styles in this diff.
Tests files are usually not checked by gjshint so we might need not to care about styles so much.

Copy link
Member Author

Choose a reason for hiding this comment

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

Darn it, this case slipped through.

@shigeki
Copy link
Contributor

shigeki commented Mar 5, 2015

I run tests without ssl and release, message parallel and sequential are fine. There still remains tests using openssl in pummel but I think very few people use tests without ssl. Overall LGTM. Good Jobs.

@jbergstroem
Copy link
Member Author

Good point regarding pummel. I'll have a look at that as well.

we had a few ways versions of looking for support before executing a test. this
commit unifies them as well as add the check for all tests that previously
lacked them. found by running `./configure --without-ssl && make test`. also,
produce tap skip output if the test is skipped.
this makes the separation between http and https testing cleaner
@jbergstroem
Copy link
Member Author

@shigeki fixed the styling nit as well as broken tests in pummel and internet. Also removed some unused stuff as a result of splitting up a test.

shigeki pushed a commit that referenced this pull request Mar 5, 2015
PR-URL: #1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
shigeki pushed a commit that referenced this pull request Mar 5, 2015
since this applies to tls and https (among other things), it'll be used
for those tests as well. if we decouple the build system to somehow support
crypto but not tls, we could refine this.

PR-URL: #1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
shigeki pushed a commit that referenced this pull request Mar 5, 2015
PR-URL: #1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
shigeki pushed a commit that referenced this pull request Mar 5, 2015
the previous version checked if io.js was compiled with openssl support which
isn't really relevant since we're starting a http server. we on the other hand
need an openssl-cli which may or may not exist.

PR-URL: #1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
shigeki pushed a commit that referenced this pull request Mar 5, 2015
we had a few ways versions of looking for support before executing a test. this
commit unifies them as well as add the check for all tests that previously
lacked them. found by running `./configure --without-ssl && make test`. also,
produce tap skip output if the test is skipped.

PR-URL: #1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
shigeki pushed a commit that referenced this pull request Mar 5, 2015
this makes the separation between http and https testing cleaner

PR-URL: #1049
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
@shigeki
Copy link
Contributor

shigeki commented Mar 5, 2015

Thanks, I checked all tests including pummel and internet are fine. Landed in 563771d , 671fbd5 , c7ad320 , 71776f9 , 3d5726c and d0e7c35 .
@bnoordhuis I add your name in the reviewer. If it is not good, please tell me it.

@shigeki shigeki closed this Mar 5, 2015
@bnoordhuis
Copy link
Member

@shigeki That's fine. My only nit is about the commit logs: the first line should be <= 50 chars, the body <= 72 chars and properly capitalized and punctuated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants