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

Replace resource expensive bcrypt test with shorter version #1231

Merged
merged 5 commits into from
Mar 23, 2018

Conversation

eiri
Copy link
Member

@eiri eiri commented Mar 22, 2018

Since we are using 3rd party app for bcrypt and couch_passwords: bcrypt/2 is just an interface for it there are no need to test correctness of the lib itself, just the fact that we are using it properly.

Test bcrypt_logRounds_18 is kind of a resource hog, so I suggest to remove it to easy a burden on Travis and Jenkins. This reduces the test runtime on my laptop from 75s to 15s and I suspect the difference for CI will be even greater.

@eiri
Copy link
Member Author

eiri commented Mar 22, 2018

@wohali @janl @rnewson Any opinion on this?

@iilyak
Copy link
Contributor

iilyak commented Mar 22, 2018

good idea.

@wohali
Copy link
Member

wohali commented Mar 22, 2018

We don't need to validate that the algorithm works when logrounds has been increased - just that it's able to function correctly when linked and used.

Good call.

@wohali
Copy link
Member

wohali commented Mar 22, 2018

Oh, thought - maybe make it bcrypt_logRounds_5 instead, or some other (lower) number, as a way to validate that you can adjust the figure and the library still does the right thing?

@eiri eiri force-pushed the remove-expensive-bcrypt_test branch from 888b0ed to cc65ddf Compare March 23, 2018 15:14
@eiri
Copy link
Member Author

eiri commented Mar 23, 2018

@wohali I've added bcrypt_logRounds_5 and (surprise!) found that the tests were actually broken - generators been returning test objects instead of running assertions, infamous and hugely common error.

I fixed that, simplified setup (we've been starting and stopping bunch of unused apps and for some reason did it for each test individually) and added the tests descriptions. How does it look for you now?

@wohali
Copy link
Member

wohali commented Mar 23, 2018

Good catch! +1 and go for it.

@wohali wohali changed the title Remove resource expensive bcrypt test Replace resource expensive bcrypt test with shorter version Mar 23, 2018
@eiri eiri merged commit 89a727b into apache:master Mar 23, 2018
@eiri eiri deleted the remove-expensive-bcrypt_test branch March 23, 2018 18:43
@wohali
Copy link
Member

wohali commented Mar 24, 2018

@eiri we got a random failure in Jenkins related to encryption after this hit master, can you investigate please?

https://builds.apache.org/blue/organizations/jenkins/CouchDB/detail/master/223/pipeline

Logs at https://couchdb-vm2.apache.org/ci_errorlogs/jenkins-couchdb-223-2018-03-23T23:15:34.663810/couchlog.tar.gz

test/javascript/tests/users_db_security.js                     
    Error: undefined
Trace back (most recent call first):
    
  52: test/javascript/test_setup.js
      T((void 0))
  35: test/javascript/tests/users_db_security.js
      ("jchris1")
  39: test/javascript/tests/users_db_security.js
      ([object Object],"org.couchdb.user:fdmanana","jchris1")
 168: test/javascript/tests/users_db_security.js
      ("pbkdf2",(function (derived_key) {TEquals(40, derived_key.length, "de
 413: test/javascript/tests/users_db_security.js
      ()
 395: test/javascript/couch_test_runner.js
      run_on_modified_server([object Array],(function () {try {testFun(schem
 411: test/javascript/tests/users_db_security.js
      ("pbkdf2",0,[object Array])
 399: test/javascript/tests/users_db_security.js
      ()
  37: test/javascript/cli_runner.js
      runTest()
  48: test/javascript/cli_runner.js

@eiri
Copy link
Member Author

eiri commented Mar 26, 2018

@wohali It's hard to imagine that fixing eunit tests would break API tests.

I looked into it and as far as I can see with bcrypt PR API test users_db_security.js was changed to be prune to racing condition - user database got deleted and re-created, which is known anti-pattern.

@wohali
Copy link
Member

wohali commented Mar 26, 2018

Thanks @eiri, sorry for leaving this request here. I wasn't accusing you of making the mistake :) I'll open a new ticket. Thank you again!

wohali pushed a commit that referenced this pull request Jul 18, 2018
* Fix the tests

* Replace resource expensive bcrypt test with shorter version

* Add tests descriptions
wohali added a commit that referenced this pull request Jul 18, 2018
wohali added a commit that referenced this pull request Jul 18, 2018
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.

3 participants