You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/03/23 18:43:04 UTC

[GitHub] eiri closed pull request #1231: Replace resource expensive bcrypt test with shorter version

eiri closed pull request #1231: Replace resource expensive bcrypt test with shorter version
URL: https://github.com/apache/couchdb/pull/1231
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/couch/test/couch_passwords_tests.erl b/src/couch/test/couch_passwords_tests.erl
index c624dba5b0..a56627361f 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).


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services