eiri commented on a change in pull request #1068: Make peruser database prefix 
configurable
URL: https://github.com/apache/couchdb/pull/1068#discussion_r161542771
 
 

 ##########
 File path: src/couch_peruser/test/couch_peruser_test.erl
 ##########
 @@ -212,6 +240,32 @@ should_delete_user_db(TestAuthDb) ->
     wait_for_db_delete(UserDbName),
     ?_assert(not lists:member(UserDbName, all_dbs())).
 
+should_delete_user_db_with_custom_prefix(TestAuthDb) ->
+    User = "bar",
+    UserDbName = <<"newuserdb-626172">>,
+    set_config("couch_peruser", "delete_dbs", "true"),
+    set_config("couch_peruser", "database_prefix", "newuserdb-"),
+    create_user(TestAuthDb, User),
+    wait_for_db_create(UserDbName),
+    ?assert(lists:member(UserDbName, all_dbs())),
 
 Review comment:
   **This is a common mistake**: `should_delete_user_db_with_custom_prefix ` is 
eunit _generator_ and this assertion here not executed during the test, but 
during the generation, i.e. in case it fail and throw exception (as `?assert` 
does) it'll kill generator and test will be just quietly skipped.
   
   What you actually need to do here is to catch result of `lists:member/1`, 
e.g. `AfterCreate = lists:member(UserDbName, all_dbs())`, do then same below 
and then return a list of assertion functions: `[?_assert(AfterCreate), 
?_assertNot(AfterDelete)]`.
   
   This is also true for the next test 
`should_delete_user_db_with_custom_special_prefix`
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to