Przeglądaj źródła

test: fix plugin ct failed

Zhongwen Deng 3 lat temu
rodzic
commit
df6141e4b8

+ 0 - 1
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
                         }

+ 3 - 2
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);

+ 4 - 3
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([]),