From ad698834df5ba7f1cd98b20d6d6f12cb58479c25 Mon Sep 17 00:00:00 2001 From: JianBo He Date: Thu, 16 Jun 2022 22:01:49 +0800 Subject: [PATCH] test(gw): fix test cases --- apps/emqx_gateway/test/emqx_coap_SUITE.erl | 4 ++-- apps/emqx_gateway/test/emqx_coap_api_SUITE.erl | 4 ++-- apps/emqx_gateway/test/emqx_exproto_SUITE.erl | 4 ++-- apps/emqx_gateway/test/emqx_lwm2m_SUITE.erl | 4 ++-- apps/emqx_gateway/test/emqx_lwm2m_api_SUITE.erl | 5 ++--- apps/emqx_gateway/test/emqx_sn_protocol_SUITE.erl | 4 ++-- apps/emqx_gateway/test/emqx_stomp_SUITE.erl | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/emqx_gateway/test/emqx_coap_SUITE.erl b/apps/emqx_gateway/test/emqx_coap_SUITE.erl index 127666c3a..774776468 100644 --- a/apps/emqx_gateway/test/emqx_coap_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_coap_SUITE.erl @@ -57,14 +57,14 @@ all() -> emqx_common_test_helpers:all(?MODULE). init_per_suite(Config) -> ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT), - emqx_mgmt_api_test_util:init_suite([emqx_gateway]), + emqx_mgmt_api_test_util:init_suite([emqx_authn, emqx_gateway]), ok = meck:new(emqx_access_control, [passthrough, no_history, no_link]), Config. end_per_suite(_) -> meck:unload(emqx_access_control), {ok, _} = emqx:remove_config([<<"gateway">>, <<"coap">>]), - emqx_mgmt_api_test_util:end_suite([emqx_gateway]). + emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_authn]). init_per_testcase(t_connection_with_authn_failed, Config) -> ok = meck:expect( diff --git a/apps/emqx_gateway/test/emqx_coap_api_SUITE.erl b/apps/emqx_gateway/test/emqx_coap_api_SUITE.erl index 7a7843c64..0f6ca22bb 100644 --- a/apps/emqx_gateway/test/emqx_coap_api_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_coap_api_SUITE.erl @@ -57,12 +57,12 @@ all() -> init_per_suite(Config) -> ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT), - emqx_mgmt_api_test_util:init_suite([emqx_gateway]), + emqx_mgmt_api_test_util:init_suite([emqx_authn, emqx_gateway]), Config. end_per_suite(Config) -> {ok, _} = emqx:remove_config([<<"gateway">>, <<"coap">>]), - emqx_mgmt_api_test_util:end_suite([emqx_gateway]), + emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_authn]), Config. %%-------------------------------------------------------------------- diff --git a/apps/emqx_gateway/test/emqx_exproto_SUITE.erl b/apps/emqx_gateway/test/emqx_exproto_SUITE.erl index 3e69c7ac7..aac779c8e 100644 --- a/apps/emqx_gateway/test/emqx_exproto_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_exproto_SUITE.erl @@ -73,12 +73,12 @@ metrics() -> init_per_group(GrpName, Cfg) -> put(grpname, GrpName), Svrs = emqx_exproto_echo_svr:start(), - emqx_common_test_helpers:start_apps([emqx_gateway], fun set_special_cfg/1), + emqx_common_test_helpers:start_apps([emqx_authn, emqx_gateway], fun set_special_cfg/1), [{servers, Svrs}, {listener_type, GrpName} | Cfg]. end_per_group(_, Cfg) -> emqx_config:erase(gateway), - emqx_common_test_helpers:stop_apps([emqx_gateway]), + emqx_common_test_helpers:stop_apps([emqx_gateway, emqx_authn]), emqx_exproto_echo_svr:stop(proplists:get_value(servers, Cfg)). set_special_cfg(emqx_gateway) -> diff --git a/apps/emqx_gateway/test/emqx_lwm2m_SUITE.erl b/apps/emqx_gateway/test/emqx_lwm2m_SUITE.erl index 39a4ac7aa..da44beb91 100644 --- a/apps/emqx_gateway/test/emqx_lwm2m_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_lwm2m_SUITE.erl @@ -155,13 +155,13 @@ groups() -> init_per_suite(Config) -> %% load application first for minirest api searching application:load(emqx_gateway), - emqx_mgmt_api_test_util:init_suite([emqx_conf]), + emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn]), Config. end_per_suite(Config) -> timer:sleep(300), {ok, _} = emqx_conf:remove([<<"gateway">>, <<"lwm2m">>], #{}), - emqx_mgmt_api_test_util:end_suite([emqx_conf]), + emqx_mgmt_api_test_util:end_suite([emqx_conf, emqx_authn]), Config. init_per_testcase(_AllTestCase, Config) -> diff --git a/apps/emqx_gateway/test/emqx_lwm2m_api_SUITE.erl b/apps/emqx_gateway/test/emqx_lwm2m_api_SUITE.erl index 0411080fd..671b4bae9 100644 --- a/apps/emqx_gateway/test/emqx_lwm2m_api_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_lwm2m_api_SUITE.erl @@ -83,13 +83,13 @@ all() -> init_per_suite(Config) -> ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT), application:load(emqx_gateway), - emqx_mgmt_api_test_util:init_suite([emqx_conf]), + emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn]), Config. end_per_suite(Config) -> timer:sleep(300), {ok, _} = emqx_conf:remove([<<"gateway">>, <<"lwm2m">>], #{}), - emqx_mgmt_api_test_util:end_suite([emqx_conf]), + emqx_mgmt_api_test_util:end_suite([emqx_authn, emqx_conf]), Config. init_per_testcase(_AllTestCase, Config) -> @@ -107,7 +107,6 @@ end_per_testcase(_AllTestCase, Config) -> gen_udp:close(?config(sock, Config)), emqtt:disconnect(?config(emqx_c, Config)), ok = application:stop(emqx_gateway), - ok = application:stop(emqx_authn), timer:sleep(300). %%-------------------------------------------------------------------- diff --git a/apps/emqx_gateway/test/emqx_sn_protocol_SUITE.erl b/apps/emqx_gateway/test/emqx_sn_protocol_SUITE.erl index 22b87f772..54928a792 100644 --- a/apps/emqx_gateway/test/emqx_sn_protocol_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_sn_protocol_SUITE.erl @@ -98,12 +98,12 @@ all() -> init_per_suite(Config) -> ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT), - emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_gateway]), + emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_authn, emqx_gateway]), Config. end_per_suite(_) -> {ok, _} = emqx:remove_config([gateway, mqttsn]), - emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_conf]). + emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_auhtn, emqx_conf]). restart_mqttsn_with_subs_resume_on() -> Conf = emqx:get_raw_config([gateway, mqttsn]), diff --git a/apps/emqx_gateway/test/emqx_stomp_SUITE.erl b/apps/emqx_gateway/test/emqx_stomp_SUITE.erl index 5dbcd8df1..3e821042d 100644 --- a/apps/emqx_gateway/test/emqx_stomp_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_stomp_SUITE.erl @@ -54,11 +54,11 @@ all() -> emqx_common_test_helpers:all(?MODULE). init_per_suite(Cfg) -> ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT), - emqx_mgmt_api_test_util:init_suite([emqx_gateway]), + emqx_mgmt_api_test_util:init_suite([emqx_authn, emqx_gateway]), Cfg. end_per_suite(_Cfg) -> - emqx_mgmt_api_test_util:end_suite([emqx_gateway]), + emqx_mgmt_api_test_util:end_suite([emqx_gateway, emqx_authn]), ok. default_config() ->