diff options
author | Eric Avdey <eiri@eiri.ca> | 2018-03-23 15:43:03 -0300 |
---|---|---|
committer | Joan Touzet <joant@atypical.net> | 2018-07-18 12:18:31 -0400 |
commit | e41996b63c8d4261d18730aab2dd91a7793e89ba (patch) | |
tree | 0b20bb1c19c117d75f6de06e007eb9d5ddde140c | |
parent | 96f487f4a5316716520acd351ae100d0c3ad8e5c (diff) | |
download | couchdb-e41996b63c8d4261d18730aab2dd91a7793e89ba.tar.gz |
Replace resource expensive bcrypt test with shorter version (#1231)
* Fix the tests
* Replace resource expensive bcrypt test with shorter version
* Add tests descriptions
-rw-r--r-- | src/couch/test/couch_passwords_tests.erl | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/couch/test/couch_passwords_tests.erl b/src/couch/test/couch_passwords_tests.erl index c624dba5b..a56627361 100644 --- a/src/couch/test/couch_passwords_tests.erl +++ b/src/couch/test/couch_passwords_tests.erl @@ -53,24 +53,24 @@ pbkdf2_test_()-> )}}]}. - -setup() -> - test_util:start(?MODULE, [bcrypt]). - -teardown(Ctx)-> - test_util:stop(Ctx). - bcrypt_test_() -> { "Bcrypt", { - foreach, - fun setup/0, fun teardown/1, + setup, + fun() -> + test_util:start_applications([bcrypt]) + end, + fun test_util:stop_applications/1, [ - {timeout, 1, fun bcrypt_logRounds_4/0}, - {timeout, 5, fun bcrypt_logRounds_12/0}, - {timeout, 180, fun bcrypt_logRounds_18/0}, - {timeout, 5, fun bcrypt_null_byte/0} + {"Log rounds: 4", + {timeout, 1, fun bcrypt_logRounds_4/0}}, + {"Log rounds: 5", + {timeout, 1, fun bcrypt_logRounds_5/0}}, + {"Log rounds: 12", + {timeout, 5, fun bcrypt_logRounds_12/0}}, + {"Null byte", + {timeout, 5, fun bcrypt_null_byte/0}} ] } @@ -79,16 +79,16 @@ bcrypt_test_() -> bcrypt_logRounds_4() -> bcrypt_assert_equal(<<"password">>, 4). +bcrypt_logRounds_5() -> + bcrypt_assert_equal(<<"password">>, 5). + bcrypt_logRounds_12() -> bcrypt_assert_equal(<<"password">>, 12). -bcrypt_logRounds_18() -> - bcrypt_assert_equal(<<"password">>, 18). - bcrypt_null_byte() -> bcrypt_assert_equal(<<"passw\0rd">>, 12). bcrypt_assert_equal(Password, Rounds) when is_integer(Rounds) -> HashPass = couch_passwords:bcrypt(Password, Rounds), ReHashPass = couch_passwords:bcrypt(Password, HashPass), - ?_assertEqual(HashPass, ReHashPass). + ?assertEqual(HashPass, ReHashPass). |