test: fix plugin ct failed
This commit is contained in:
parent
2c879b7e13
commit
df6141e4b8
|
@ -173,7 +173,6 @@ t_update_re_failed(_Config) ->
|
|||
[
|
||||
{validation_error,
|
||||
#{
|
||||
path := "root.rewrite.1.re",
|
||||
reason := {Re, {"nothing to repeat", 0}},
|
||||
value := Re
|
||||
}
|
||||
|
|
|
@ -575,8 +575,9 @@ put_config(Path, Values) when is_list(Path) ->
|
|||
|
||||
bin_key(Map) when is_map(Map) ->
|
||||
maps:fold(fun(K, V, Acc) -> Acc#{bin(K) => V} end, #{}, Map);
|
||||
bin_key(List) when is_list(List) ->
|
||||
lists:map(fun(M) -> bin_key(M) end, List).
|
||||
bin_key(List = [#{} | _]) ->
|
||||
lists:map(fun(M) -> bin_key(M) end, List);
|
||||
bin_key(Term) -> Term.
|
||||
|
||||
get_config(Key, Default) when is_atom(Key) ->
|
||||
get_config([Key], Default);
|
||||
|
|
|
@ -31,19 +31,20 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
|||
init_per_suite(Config) ->
|
||||
WorkDir = proplists:get_value(data_dir, Config),
|
||||
OrigInstallDir = emqx_plugins:get_config(install_dir, undefined),
|
||||
emqx_common_test_helpers:start_apps([emqx_conf]),
|
||||
emqx_plugins:put_config(install_dir, WorkDir),
|
||||
emqx_common_test_helpers:start_apps([]),
|
||||
[{orig_install_dir, OrigInstallDir} | Config].
|
||||
|
||||
end_per_suite(Config) ->
|
||||
emqx_common_test_helpers:boot_modules(all),
|
||||
emqx_common_test_helpers:stop_apps([]),
|
||||
emqx_config:erase(plugins),
|
||||
%% restore config
|
||||
case proplists:get_value(orig_install_dir, Config) of
|
||||
undefined -> ok;
|
||||
OrigInstallDir -> emqx_plugins:put_config(install_dir, OrigInstallDir)
|
||||
end.
|
||||
end,
|
||||
emqx_common_test_helpers:stop_apps([emqx_conf]),
|
||||
ok.
|
||||
|
||||
init_per_testcase(TestCase, Config) ->
|
||||
emqx_plugins:put_configured([]),
|
||||
|
|
Loading…
Reference in New Issue