Merge pull request #12249 from zhongwencool/log-prompt-garbled
fix: the API prompt garbled characters for updating the configuration
This commit is contained in:
commit
f2f099ff18
|
@ -35,7 +35,7 @@
|
|||
-define(CLUSTER_CALL, cluster_call).
|
||||
-define(CONF, conf).
|
||||
-define(AUDIT_MOD, audit).
|
||||
-define(UPDATE_READONLY_KEYS_PROHIBITED, "update_readonly_keys_prohibited").
|
||||
-define(UPDATE_READONLY_KEYS_PROHIBITED, <<"update_readonly_keys_prohibited">>).
|
||||
|
||||
-dialyzer({no_match, [load/0]}).
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ t_load_readonly(Config) ->
|
|||
ConfBin0 = hocon_pp:do(Base1#{KeyBin => Conf}, #{}),
|
||||
ConfFile0 = prepare_conf_file(?FUNCTION_NAME, ConfBin0, Config),
|
||||
?assertEqual(
|
||||
{error, "update_readonly_keys_prohibited"},
|
||||
{error, <<"update_readonly_keys_prohibited">>},
|
||||
emqx_conf_cli:conf(["load", ConfFile0])
|
||||
),
|
||||
%% reload etc/emqx.conf changed readonly keys
|
||||
|
|
|
@ -331,7 +331,7 @@ t_configs_key(_Config) ->
|
|||
Log
|
||||
),
|
||||
Log1 = emqx_utils_maps:deep_put([<<"log">>, <<"console">>, <<"level">>], Log, <<"error">>),
|
||||
?assertEqual([], update_configs_with_binary(iolist_to_binary(hocon_pp:do(Log1, #{})))),
|
||||
?assertEqual(<<>>, update_configs_with_binary(iolist_to_binary(hocon_pp:do(Log1, #{})))),
|
||||
?assertEqual(<<"error">>, read_conf([<<"log">>, <<"console">>, <<"level">>])),
|
||||
BadLog = emqx_utils_maps:deep_put([<<"log">>, <<"console">>, <<"level">>], Log, <<"erro1r">>),
|
||||
{error, Error} = update_configs_with_binary(iolist_to_binary(hocon_pp:do(BadLog, #{}))),
|
||||
|
@ -345,6 +345,17 @@ t_configs_key(_Config) ->
|
|||
}
|
||||
},
|
||||
?assertEqual(ExpectError, emqx_utils_json:decode(Error, [return_maps])),
|
||||
ReadOnlyConf = #{
|
||||
<<"cluster">> =>
|
||||
#{
|
||||
<<"autoclean">> => <<"23h">>,
|
||||
<<"autoheal">> => true,
|
||||
<<"discovery_strategy">> => <<"manual">>
|
||||
}
|
||||
},
|
||||
ReadOnlyBin = iolist_to_binary(hocon_pp:do(ReadOnlyConf, #{})),
|
||||
{error, ReadOnlyError} = update_configs_with_binary(ReadOnlyBin),
|
||||
?assertEqual(<<"update_readonly_keys_prohibited">>, ReadOnlyError),
|
||||
ok.
|
||||
|
||||
t_get_configs_in_different_accept(_Config) ->
|
||||
|
@ -394,7 +405,7 @@ t_create_webhook_v1_bridges_api(Config) ->
|
|||
WebHookFile = filename:join(?config(data_dir, Config), "webhook_v1.conf"),
|
||||
?assertMatch({ok, _}, hocon:files([WebHookFile])),
|
||||
{ok, WebHookBin} = file:read_file(WebHookFile),
|
||||
?assertEqual([], update_configs_with_binary(WebHookBin)),
|
||||
?assertEqual(<<>>, update_configs_with_binary(WebHookBin)),
|
||||
Actions =
|
||||
#{
|
||||
<<"http">> =>
|
||||
|
@ -531,7 +542,7 @@ update_configs_with_binary(Bin) ->
|
|||
Path = emqx_mgmt_api_test_util:api_path(["configs"]),
|
||||
Auth = emqx_mgmt_api_test_util:auth_header_(),
|
||||
Headers = [{"accept", "text/plain"}, Auth],
|
||||
case httpc:request(put, {Path, Headers, "text/plain", Bin}, [], []) of
|
||||
case httpc:request(put, {Path, Headers, "text/plain", Bin}, [], [{body_format, binary}]) of
|
||||
{ok, {{"HTTP/1.1", Code, _}, _Headers, Body}} when
|
||||
Code >= 200 andalso Code =< 299
|
||||
->
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Modified the /file_transfer API to return the file transfer configuration in raw format rather than converting time units like "1h" to seconds, providing callers with the original configured values for consistency with other getter APIs
|
|
@ -0,0 +1 @@
|
|||
Fixed issue where the response message from the /configs API would be garbled when attempting to update a read-only configuration value
|
Loading…
Reference in New Issue