This is an automated email from the ASF dual-hosted git repository. wohali pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 91f84f3314b4e54767e43f57d46a3724b6e69db6 Author: Joan Touzet <[email protected]> AuthorDate: Wed Jul 18 12:23:49 2018 -0400 Revert "Replace resource expensive bcrypt test with shorter version (#1231)" This reverts commit 89a727b625e74f40fcf612bda18421b8fc21eead. --- src/couch/test/couch_passwords_tests.erl | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/couch/test/couch_passwords_tests.erl b/src/couch/test/couch_passwords_tests.erl index a566273..c624dba 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", { - setup, - fun() -> - test_util:start_applications([bcrypt]) - end, - fun test_util:stop_applications/1, + foreach, + fun setup/0, fun teardown/1, [ - {"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}} + {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} ] } @@ -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).
