diff --git a/apps/emqx_modules/test/emqx_rewrite_SUITE.erl b/apps/emqx_modules/test/emqx_rewrite_SUITE.erl index 96ba4bf86..cdc4b4521 100644 --- a/apps/emqx_modules/test/emqx_rewrite_SUITE.erl +++ b/apps/emqx_modules/test/emqx_rewrite_SUITE.erl @@ -173,7 +173,6 @@ t_update_re_failed(_Config) -> [ {validation_error, #{ - path := "root.rewrite.1.re", reason := {Re, {"nothing to repeat", 0}}, value := Re } diff --git a/apps/emqx_plugins/src/emqx_plugins.erl b/apps/emqx_plugins/src/emqx_plugins.erl index 8b37bec0a..09b7a735e 100644 --- a/apps/emqx_plugins/src/emqx_plugins.erl +++ b/apps/emqx_plugins/src/emqx_plugins.erl @@ -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); diff --git a/apps/emqx_plugins/test/emqx_plugins_SUITE.erl b/apps/emqx_plugins/test/emqx_plugins_SUITE.erl index 8d50ef7f7..00c8b4226 100644 --- a/apps/emqx_plugins/test/emqx_plugins_SUITE.erl +++ b/apps/emqx_plugins/test/emqx_plugins_SUITE.erl @@ -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([]),