test(mongo): add test case for w_mode option

This commit is contained in:
zhouzb 2022-01-06 10:42:16 +08:00
parent c33eb84cb6
commit 821b50a961
4 changed files with 6 additions and 1 deletions

View File

@ -82,7 +82,8 @@ t_create_invalid(_Config) ->
InvalidConfigs =
[
AuthConfig#{mongo_type => <<"unknown">>},
AuthConfig#{selector => <<"{ \"username\": \"${username}\" }">>}
AuthConfig#{selector => <<"{ \"username\": \"${username}\" }">>},
AuthConfig#{w_mode => <<"unknown">>}
],
lists:foreach(
@ -247,6 +248,7 @@ raw_mongo_auth_config() ->
database => <<"mqtt">>,
collection => <<"users">>,
server => mongo_server(),
w_mode => <<"unsafe">>,
selector => #{<<"username">> => <<"${username}">>},
password_hash_field => <<"password_hash">>,

View File

@ -160,6 +160,7 @@ raw_mongo_auth_config(SpecificSSLOpts) ->
database => <<"mqtt">>,
collection => <<"users">>,
server => mongo_server(),
w_mode => <<"unsafe">>,
selector => #{<<"username">> => <<"${username}">>},
password_hash_field => <<"password_hash">>,

View File

@ -73,6 +73,7 @@ set_special_configs(_App) ->
<<"enable">> => true,
<<"mongo_type">> => <<"single">>,
<<"server">> => <<"127.0.0.1:27017">>,
<<"w_mode">> => <<"unsafe">>,
<<"pool_size">> => 1,
<<"database">> => <<"mqtt">>,
<<"ssl">> => #{<<"enable">> => false},

View File

@ -39,6 +39,7 @@
<<"enable">> => true,
<<"mongo_type">> => <<"single">>,
<<"server">> => <<?MONGO_SINGLE_HOST>>,
<<"w_mode">> => <<"unsafe">>,
<<"pool_size">> => 1,
<<"database">> => <<"mqtt">>,
<<"ssl">> => #{<<"enable">> => false},