From 2cfe5ba057c433a044657dd648df893cc5702925 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 4 Sep 2023 14:37:25 -0300 Subject: [PATCH] fix(plugins_api): fix response types and test --- apps/emqx_management/src/emqx_mgmt_api_plugins.erl | 5 ++++- apps/emqx_management/test/emqx_mgmt_api_plugins_SUITE.erl | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt_api_plugins.erl b/apps/emqx_management/src/emqx_mgmt_api_plugins.erl index 81c765fc4..c89ee202e 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_plugins.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_plugins.erl @@ -166,7 +166,10 @@ schema("/plugins/:name/move") -> tags => ?TAGS, parameters => [hoconsc:ref(name)], 'requestBody' => move_request_body(), - responses => #{200 => <<"OK">>} + responses => #{ + 200 => <<"OK">>, + 400 => emqx_dashboard_swagger:error_codes(['MOVE_FAILED'], <<"Move failed">>) + } } }. diff --git a/apps/emqx_management/test/emqx_mgmt_api_plugins_SUITE.erl b/apps/emqx_management/test/emqx_mgmt_api_plugins_SUITE.erl index 1cddad76d..61ed94bdc 100644 --- a/apps/emqx_management/test/emqx_mgmt_api_plugins_SUITE.erl +++ b/apps/emqx_management/test/emqx_mgmt_api_plugins_SUITE.erl @@ -297,7 +297,8 @@ update_plugin(Config, Name, Action) when is_list(Config) -> update_boot_order(Name, MoveBody, Config) -> #{host := Host, auth := Auth} = get_host_and_auth(Config), Path = emqx_mgmt_api_test_util:api_path(Host, ["plugins", Name, "move"]), - case emqx_mgmt_api_test_util:request_api(post, Path, "", Auth, MoveBody) of + Opts = #{return_all => true}, + case emqx_mgmt_api_test_util:request_api(post, Path, "", Auth, MoveBody, Opts) of {ok, Res} -> Resp = case emqx_utils_json:safe_decode(Res, [return_maps]) of @@ -362,8 +363,8 @@ cluster(TestCase, Config) -> app_specs(_Config) -> [ - emqx_conf, emqx, + emqx_conf, emqx_management, emqx_plugins ].