diff --git a/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl b/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl index 0072447b6..7495c5858 100644 --- a/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_gateway_authn_SUITE.erl @@ -22,7 +22,7 @@ -include_lib("eunit/include/eunit.hrl"). -include_lib("common_test/include/ct.hrl"). --import(emqx_gateway_auth_ct, [init_gateway_conf/0, with_resource/3]). +-import(emqx_gateway_auth_ct, [with_resource/3]). -define(checkMatch(Guard), (fun(Expr) -> @@ -54,40 +54,37 @@ groups() -> emqx_gateway_auth_ct:init_groups(?MODULE, ?AUTHNS). init_per_group(AuthName, Conf) -> - ct:pal("on group start:~p~n", [AuthName]), - {ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000), - emqx_gateway_auth_ct:start_auth(AuthName), - timer:sleep(500), - Conf. + Apps = emqx_cth_suite:start( + [ + emqx_conf, + emqx_auth, + emqx_auth_http, + emqx_management, + {emqx_dashboard, "dashboard.listeners.http { enable = true, bind = 18083 }"}, + {emqx_gateway, emqx_gateway_auth_ct:list_gateway_conf()} + | emqx_gateway_test_utils:all_gateway_apps() + ], + #{work_dir => emqx_cth_suite:work_dir(Conf)} + ), + _ = emqx_common_test_http:create_default_app(), + ok = emqx_gateway_auth_ct:start_auth(AuthName), + [{group_apps, Apps} | Conf]. end_per_group(AuthName, Conf) -> - ct:pal("on group stop:~p~n", [AuthName]), - emqx_gateway_auth_ct:stop_auth(AuthName), + ok = emqx_gateway_auth_ct:stop_auth(AuthName), + _ = emqx_common_test_http:delete_default_app(), + ok = emqx_cth_suite:stop(?config(group_apps, Conf)), Conf. init_per_suite(Config) -> - emqx_gateway_test_utils:load_all_gateway_apps(), - emqx_config:erase(gateway), - init_gateway_conf(), - emqx_mgmt_api_test_util:init_suite([grpc, emqx_conf, emqx_auth, emqx_auth_http, emqx_gateway]), - application:ensure_all_started(cowboy), - emqx_gateway_auth_ct:start(), - timer:sleep(500), - Config. + {ok, Apps1} = application:ensure_all_started(grpc), + {ok, Apps2} = application:ensure_all_started(cowboy), + {ok, _} = emqx_gateway_auth_ct:start(), + [{suite_apps, Apps1 ++ Apps2} | Config]. end_per_suite(Config) -> - emqx_gateway_auth_ct:stop(), - emqx_config:erase(gateway), - emqx_mgmt_api_test_util:end_suite([ - cowboy, emqx_conf, emqx_auth, emqx_auth_http, emqx_gateway, grpc - ]), - Config. - -init_per_testcase(_Case, Config) -> - {ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000), - Config. - -end_per_testcase(_Case, Config) -> + ok = emqx_gateway_auth_ct:stop(), + ok = emqx_cth_suite:stop_apps(?config(suite_apps, Config)), Config. %%------------------------------------------------------------------------------