Parcourir la source

fix: replace deep_merge with merge.

Zhongwen Deng il y a 4 ans
Parent
commit
71d20d153b

+ 1 - 1
apps/emqx/src/emqx_config_handler.erl

@@ -288,7 +288,7 @@ save_configs(ConfKeyPath, AppEnvs, CheckedConf, NewRawConf, OverrideConf, Update
 %%   2. either the old or the new config is not of map type
 %% the behaviour is merging the new the config to the old config if they are maps.
 merge_to_old_config(UpdateReq, RawConf) when is_map(UpdateReq), is_map(RawConf) ->
-    {ok, emqx_map_lib:deep_merge(RawConf, UpdateReq)};
+    {ok, maps:merge(RawConf, UpdateReq)};
 merge_to_old_config(UpdateReq, _RawConf) ->
     {ok, UpdateReq}.
 

+ 8 - 2
apps/emqx_connector/test/emqx_connector_api_SUITE.erl

@@ -113,8 +113,14 @@ set_special_configs(_) ->
 init_per_testcase(_, Config) ->
     {ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000),
     %% assert we there's no connectors and no bridges at first
-    {ok, 200, <<"[]">>} = request(get, uri(["connectors"]), []),
-    {ok, 200, <<"[]">>} = request(get, uri(["bridges"]), []),
+    {ok, 200, Connectors} = request(get, uri(["connectors"]), []),
+    lists:foreach(fun(#{<<"id">> := ConnectorID}) ->
+        {ok, 200, <<>>} = request(delete, uri(["connectors", ConnectorID]), [])
+                  end, jsx:decode(Connectors)),
+    {ok, 200, Bridges} = request(get, uri(["bridges"]), []),
+    lists:foreach(fun(#{<<"id">> := BridgeID}) ->
+        {ok, 204, <<>>} = request(delete, uri(["bridges", BridgeID]), [])
+              end,  jsx:decode(Bridges)),
     Config.
 end_per_testcase(_, _Config) ->
     clear_resources(),

+ 4 - 1
apps/emqx_modules/test/emqx_rewrite_SUITE.erl

@@ -168,7 +168,10 @@ t_update_re_failed(_Config) ->
     }],
     Error = {badmatch,
         {error,
-            {emqx_modules_schema,
+            {#{fields =>
+            #{root => [{"rewrite",
+                {array, {ref,emqx_modules_schema,"rewrite"}}}]},
+                roots => [root]},
                 [{validation_error,
                     #{path => "rewrite.1.re",
                       reason => {<<"*^test/*">>,{"nothing to repeat",0}},