test(gw-authn): switch to `emqx_cth_suite` + simplify testsuite
This commit is contained in:
parent
76c89ad372
commit
ccb9a977d6
|
@ -22,7 +22,7 @@
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("common_test/include/ct.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),
|
-define(checkMatch(Guard),
|
||||||
(fun(Expr) ->
|
(fun(Expr) ->
|
||||||
|
@ -54,40 +54,37 @@ groups() ->
|
||||||
emqx_gateway_auth_ct:init_groups(?MODULE, ?AUTHNS).
|
emqx_gateway_auth_ct:init_groups(?MODULE, ?AUTHNS).
|
||||||
|
|
||||||
init_per_group(AuthName, Conf) ->
|
init_per_group(AuthName, Conf) ->
|
||||||
ct:pal("on group start:~p~n", [AuthName]),
|
Apps = emqx_cth_suite:start(
|
||||||
{ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000),
|
[
|
||||||
emqx_gateway_auth_ct:start_auth(AuthName),
|
emqx_conf,
|
||||||
timer:sleep(500),
|
emqx_auth,
|
||||||
Conf.
|
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) ->
|
end_per_group(AuthName, Conf) ->
|
||||||
ct:pal("on group stop:~p~n", [AuthName]),
|
ok = emqx_gateway_auth_ct:stop_auth(AuthName),
|
||||||
emqx_gateway_auth_ct:stop_auth(AuthName),
|
_ = emqx_common_test_http:delete_default_app(),
|
||||||
|
ok = emqx_cth_suite:stop(?config(group_apps, Conf)),
|
||||||
Conf.
|
Conf.
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_gateway_test_utils:load_all_gateway_apps(),
|
{ok, Apps1} = application:ensure_all_started(grpc),
|
||||||
emqx_config:erase(gateway),
|
{ok, Apps2} = application:ensure_all_started(cowboy),
|
||||||
init_gateway_conf(),
|
{ok, _} = emqx_gateway_auth_ct:start(),
|
||||||
emqx_mgmt_api_test_util:init_suite([grpc, emqx_conf, emqx_auth, emqx_auth_http, emqx_gateway]),
|
[{suite_apps, Apps1 ++ Apps2} | Config].
|
||||||
application:ensure_all_started(cowboy),
|
|
||||||
emqx_gateway_auth_ct:start(),
|
|
||||||
timer:sleep(500),
|
|
||||||
Config.
|
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_gateway_auth_ct:stop(),
|
ok = emqx_gateway_auth_ct:stop(),
|
||||||
emqx_config:erase(gateway),
|
ok = emqx_cth_suite:stop_apps(?config(suite_apps, Config)),
|
||||||
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) ->
|
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue