summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <joant@atypical.net>2018-07-18 12:23:49 -0400
committerJoan Touzet <wohali@users.noreply.github.com>2018-07-18 14:31:35 -0400
commit91f84f3314b4e54767e43f57d46a3724b6e69db6 (patch)
tree5bdb174f5266cca288ae79a86c9bdd29ce5b0bcb
parentc94cc4cea335f7ef747fa97fd3b7df8a1ae902cf (diff)
downloadcouchdb-91f84f3314b4e54767e43f57d46a3724b6e69db6.tar.gz
Revert "Replace resource expensive bcrypt test with shorter version (#1231)"
This reverts commit 89a727b625e74f40fcf612bda18421b8fc21eead.
-rw-r--r--src/couch/test/couch_passwords_tests.erl34
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 a56627361..c624dba5b 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).