refactor(config): remove emqx:get_env/1,2 from testcases
This commit is contained in:
parent
0a3b77f65d
commit
f2e62def1b
|
@ -31,23 +31,13 @@ all() ->
|
|||
|
||||
init_per_suite(Config) ->
|
||||
application:set_env(ekka, strict_mode, true),
|
||||
emqx_ct_helpers:start_apps([emqx_authn], fun set_special_configs/1),
|
||||
emqx_ct_helpers:start_apps([emqx_authn]),
|
||||
Config.
|
||||
|
||||
end_per_suite(_) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'emqx_authn.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authn]),
|
||||
ok.
|
||||
|
||||
set_special_configs(emqx_authn) ->
|
||||
application:set_env(emqx, plugins_etc_dir,
|
||||
emqx_ct_helpers:deps_path(emqx_authn, "test")),
|
||||
Conf = #{<<"emqx_authn">> => #{<<"authenticators">> => [], <<"enable">> => false}},
|
||||
ok = file:write_file(filename:join(emqx:get_env(plugins_etc_dir), 'emqx_authn.conf'), jsx:encode(Conf)),
|
||||
ok;
|
||||
set_special_configs(_App) ->
|
||||
ok.
|
||||
|
||||
t_chain(_) ->
|
||||
?assertMatch({ok, #{id := ?CHAIN, authenticators := []}}, ?AUTH:lookup_chain(?CHAIN)),
|
||||
|
||||
|
|
|
@ -30,23 +30,13 @@ all() ->
|
|||
emqx_ct:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:start_apps([emqx_authn], fun set_special_configs/1),
|
||||
emqx_ct_helpers:start_apps([emqx_authn]),
|
||||
Config.
|
||||
|
||||
end_per_suite(_) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'emqx_authn.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authn]),
|
||||
ok.
|
||||
|
||||
set_special_configs(emqx_authn) ->
|
||||
application:set_env(emqx, plugins_etc_dir,
|
||||
emqx_ct_helpers:deps_path(emqx_authn, "test")),
|
||||
Conf = #{<<"emqx_authn">> => #{<<"authenticators">> => [], <<"enable">> => false}},
|
||||
ok = file:write_file(filename:join(emqx:get_env(plugins_etc_dir), 'emqx_authn.conf'), jsx:encode(Conf)),
|
||||
ok;
|
||||
set_special_configs(_App) ->
|
||||
ok.
|
||||
|
||||
t_jwt_authenticator(_) ->
|
||||
AuthenticatorName = <<"myauthenticator">>,
|
||||
Config = #{use_jwks => false,
|
||||
|
|
|
@ -30,23 +30,13 @@ all() ->
|
|||
emqx_ct:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
emqx_ct_helpers:start_apps([emqx_authn], fun set_special_configs/1),
|
||||
emqx_ct_helpers:start_apps([emqx_authn]),
|
||||
Config.
|
||||
|
||||
end_per_suite(_) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'emqx_authn.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authn]),
|
||||
ok.
|
||||
|
||||
set_special_configs(emqx_authn) ->
|
||||
application:set_env(emqx, plugins_etc_dir,
|
||||
emqx_ct_helpers:deps_path(emqx_authn, "test")),
|
||||
Conf = #{<<"emqx_authn">> => #{<<"authenticators">> => [], <<"enable">> => false}},
|
||||
ok = file:write_file(filename:join(emqx:get_env(plugins_etc_dir), 'emqx_authn.conf'), jsx:encode(Conf)),
|
||||
ok;
|
||||
set_special_configs(_App) ->
|
||||
ok.
|
||||
|
||||
t_mnesia_authenticator(_) ->
|
||||
AuthenticatorName = <<"myauthenticator">>,
|
||||
AuthenticatorConfig = #{name => AuthenticatorName,
|
||||
|
|
|
@ -36,7 +36,6 @@ init_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz]).
|
||||
|
||||
-define(RULE1, #{principal => all,
|
||||
|
|
|
@ -53,7 +53,6 @@ init_per_suite(Config) ->
|
|||
|
||||
end_per_suite(_Config) ->
|
||||
%delete_default_app(),
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
meck:unload(emqx_schema),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz]).
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ init_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]),
|
||||
meck:unload(emqx_schema),
|
||||
meck:unload(emqx_resource).
|
||||
|
|
|
@ -55,7 +55,6 @@ init_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]),
|
||||
meck:unload(emqx_schema),
|
||||
meck:unload(emqx_resource).
|
||||
|
|
|
@ -54,7 +54,6 @@ init_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]),
|
||||
meck:unload(emqx_schema),
|
||||
meck:unload(emqx_resource).
|
||||
|
|
|
@ -53,7 +53,6 @@ init_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]),
|
||||
meck:unload(emqx_schema),
|
||||
meck:unload(emqx_resource).
|
||||
|
|
|
@ -52,7 +52,6 @@ init_per_suite(Config) ->
|
|||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
file:delete(filename:join(emqx:get_env(plugins_etc_dir), 'authz.conf')),
|
||||
emqx_ct_helpers:stop_apps([emqx_authz, emqx_resource]),
|
||||
meck:unload(emqx_schema),
|
||||
meck:unload(emqx_resource).
|
||||
|
|
Loading…
Reference in New Issue