rnewson commented on code in PR #5820: URL: https://github.com/apache/couchdb/pull/5820#discussion_r2599362157
########## src/couch/test/eunit/couch_passwords_hasher_tests.erl: ########## @@ -0,0 +1,196 @@ +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + +-module(couch_passwords_hasher_tests). + +-include_lib("couch/include/couch_db.hrl"). +-include_lib("couch/include/couch_eunit.hrl"). + +-define(USER, "couch_passowrds_hash_test_admin"). Review Comment: typo ########## src/couch/src/couch_password_hasher.erl: ########## @@ -141,7 +144,7 @@ worker_loop(Parent) -> receive {upgrade_password_hash, Req, UserName, Password, UserProps, AuthModule, AuthCtx} -> couch_log:notice("upgrading stored password hash for '~s' (~p)", [UserName, AuthCtx]), - upgrade_password_hash(Req, UserName, Password, UserProps, AuthModule, AuthCtx), + ?MODULE:upgrade_password_hash(Req, UserName, Password, UserProps, AuthModule, AuthCtx), Review Comment: the (careful) use of module-qualified function calls is an important part of live upgrades (I appreciate Cloudant doesn't do them anymore but others might). I don't think it's wise to abuse it for testing. Perhaps the module needs some rearranging to make it more testable but, for example, you could call upgrade_password_hash/6 in an eunit tests declared in this file rather than the test/eunit hierarchy, and that way we also don't need to export them. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
