fix: replace deep_merge with merge.

This commit is contained in:
Zhongwen Deng 2022-03-03 22:52:46 +08:00
parent 4dfcb90b16
commit 71d20d153b
3 changed files with 13 additions and 4 deletions

View File

@ -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}.

View File

@ -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(),

View File

@ -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}},