From 7f1bec5d7892b125aff2735cc7819eb8e6399869 Mon Sep 17 00:00:00 2001 From: firest Date: Fri, 8 Apr 2022 13:36:57 +0800 Subject: [PATCH] test(gateway): fix meck unload error and reformat some codes --- apps/emqx_gateway/test/emqx_gateway_auth_ct.erl | 8 ++++---- apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl | 10 +++++----- apps/emqx_gateway/test/emqx_gateway_ctx_SUITE.erl | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/emqx_gateway/test/emqx_gateway_auth_ct.erl b/apps/emqx_gateway/test/emqx_gateway_auth_ct.erl index 7702a601f..92c403b11 100644 --- a/apps/emqx_gateway/test/emqx_gateway_auth_ct.erl +++ b/apps/emqx_gateway/test/emqx_gateway_auth_ct.erl @@ -136,8 +136,8 @@ on_start_auth(authn_http) -> %% set handler for test server Handler = fun(Req0, State) -> - ct:pal("Authn Req:~p~nState:~p~n", [Req0, State]), - case cowboy_req:match_qs([username, password], Req0) of + ct:pal("Authn Req:~p~nState:~p~n", [Req0, State]), + case cowboy_req:match_qs([username, password], Req0) of #{ username := <<"admin">>, password := <<"public">> @@ -154,8 +154,8 @@ on_start_auth(authn_http) -> on_stop_auth(authn_http) -> Delete = fun(Gateway) -> - Path = io_lib:format("/gateway/~ts/authentication", [Gateway]), - {204, _} = request(delete, Path) + Path = io_lib:format("/gateway/~ts/authentication", [Gateway]), + {204, _} = request(delete, Path) end, lists:foreach(Delete, ?GATEWAYS), ok = emqx_authn_http_test_server:stop(). diff --git a/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl b/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl index 6b71f06b5..33c0a2eea 100644 --- a/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl @@ -93,11 +93,11 @@ end_per_testcase(_Case, Config) -> t_case_coap(_) -> Login = fun(URI, Checker) -> - Action = fun(Channel) -> - Req = emqx_coap_SUITE:make_req(post), - Checker(emqx_coap_SUITE:do_request(Channel, URI, Req)) - end, - emqx_coap_SUITE:do(Action) + Action = fun(Channel) -> + Req = emqx_coap_SUITE:make_req(post), + Checker(emqx_coap_SUITE:do_request(Channel, URI, Req)) + end, + emqx_coap_SUITE:do(Action) end, Prefix = emqx_coap_SUITE:mqtt_prefix(), RightUrl = diff --git a/apps/emqx_gateway/test/emqx_gateway_ctx_SUITE.erl b/apps/emqx_gateway/test/emqx_gateway_ctx_SUITE.erl index f0ca75e24..32e155068 100644 --- a/apps/emqx_gateway/test/emqx_gateway_ctx_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_gateway_ctx_SUITE.erl @@ -42,6 +42,7 @@ init_per_suite(Conf) -> Conf. end_per_suite(_Conf) -> + meck:unload(emqx_access_control), ok. %%--------------------------------------------------------------------