test(gw): fix test cases
This commit is contained in:
parent
ae1346e3f0
commit
ad698834df
|
@ -57,14 +57,14 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
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]),
|
ok = meck:new(emqx_access_control, [passthrough, no_history, no_link]),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_) ->
|
end_per_suite(_) ->
|
||||||
meck:unload(emqx_access_control),
|
meck:unload(emqx_access_control),
|
||||||
{ok, _} = emqx:remove_config([<<"gateway">>, <<"coap">>]),
|
{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) ->
|
init_per_testcase(t_connection_with_authn_failed, Config) ->
|
||||||
ok = meck:expect(
|
ok = meck:expect(
|
||||||
|
|
|
@ -57,12 +57,12 @@ all() ->
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
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.
|
Config.
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
{ok, _} = emqx:remove_config([<<"gateway">>, <<"coap">>]),
|
{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.
|
Config.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -73,12 +73,12 @@ metrics() ->
|
||||||
init_per_group(GrpName, Cfg) ->
|
init_per_group(GrpName, Cfg) ->
|
||||||
put(grpname, GrpName),
|
put(grpname, GrpName),
|
||||||
Svrs = emqx_exproto_echo_svr:start(),
|
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].
|
[{servers, Svrs}, {listener_type, GrpName} | Cfg].
|
||||||
|
|
||||||
end_per_group(_, Cfg) ->
|
end_per_group(_, Cfg) ->
|
||||||
emqx_config:erase(gateway),
|
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)).
|
emqx_exproto_echo_svr:stop(proplists:get_value(servers, Cfg)).
|
||||||
|
|
||||||
set_special_cfg(emqx_gateway) ->
|
set_special_cfg(emqx_gateway) ->
|
||||||
|
|
|
@ -155,13 +155,13 @@ groups() ->
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
%% load application first for minirest api searching
|
%% load application first for minirest api searching
|
||||||
application:load(emqx_gateway),
|
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.
|
Config.
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
timer:sleep(300),
|
timer:sleep(300),
|
||||||
{ok, _} = emqx_conf:remove([<<"gateway">>, <<"lwm2m">>], #{}),
|
{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.
|
Config.
|
||||||
|
|
||||||
init_per_testcase(_AllTestCase, Config) ->
|
init_per_testcase(_AllTestCase, Config) ->
|
||||||
|
|
|
@ -83,13 +83,13 @@ all() ->
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
||||||
application:load(emqx_gateway),
|
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.
|
Config.
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
timer:sleep(300),
|
timer:sleep(300),
|
||||||
{ok, _} = emqx_conf:remove([<<"gateway">>, <<"lwm2m">>], #{}),
|
{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.
|
Config.
|
||||||
|
|
||||||
init_per_testcase(_AllTestCase, Config) ->
|
init_per_testcase(_AllTestCase, Config) ->
|
||||||
|
@ -107,7 +107,6 @@ end_per_testcase(_AllTestCase, Config) ->
|
||||||
gen_udp:close(?config(sock, Config)),
|
gen_udp:close(?config(sock, Config)),
|
||||||
emqtt:disconnect(?config(emqx_c, Config)),
|
emqtt:disconnect(?config(emqx_c, Config)),
|
||||||
ok = application:stop(emqx_gateway),
|
ok = application:stop(emqx_gateway),
|
||||||
ok = application:stop(emqx_authn),
|
|
||||||
timer:sleep(300).
|
timer:sleep(300).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -98,12 +98,12 @@ all() ->
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
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.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_) ->
|
end_per_suite(_) ->
|
||||||
{ok, _} = emqx:remove_config([gateway, mqttsn]),
|
{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() ->
|
restart_mqttsn_with_subs_resume_on() ->
|
||||||
Conf = emqx:get_raw_config([gateway, mqttsn]),
|
Conf = emqx:get_raw_config([gateway, mqttsn]),
|
||||||
|
|
|
@ -54,11 +54,11 @@ all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Cfg) ->
|
init_per_suite(Cfg) ->
|
||||||
ok = emqx_common_test_helpers:load_config(emqx_gateway_schema, ?CONF_DEFAULT),
|
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.
|
Cfg.
|
||||||
|
|
||||||
end_per_suite(_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.
|
ok.
|
||||||
|
|
||||||
default_config() ->
|
default_config() ->
|
||||||
|
|
Loading…
Reference in New Issue