test(emqx): switch select test suites to use `emqx_cth_suite`
This commit is contained in:
parent
89c7de9a5e
commit
7d80511b3a
|
@ -19,7 +19,6 @@
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
|
||||||
-include_lib("emqx/include/emqx.hrl").
|
|
||||||
-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").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
|
@ -39,12 +38,11 @@
|
||||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
Apps = emqx_cth_suite:start([emqx], #{work_dir => emqx_cth_suite:work_dir(Config)}),
|
||||||
emqx_common_test_helpers:start_apps([]),
|
[{apps, Apps} | Config].
|
||||||
Config.
|
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:stop_apps([]).
|
emqx_cth_suite:stop(proplists:get_value(apps, Config)).
|
||||||
|
|
||||||
init_per_testcase(TestCase, Config) ->
|
init_per_testcase(TestCase, Config) ->
|
||||||
case erlang:function_exported(?MODULE, TestCase, 2) of
|
case erlang:function_exported(?MODULE, TestCase, 2) of
|
||||||
|
|
|
@ -26,12 +26,11 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:start_apps([]),
|
Apps = emqx_cth_suite:start([emqx], #{work_dir => emqx_cth_suite:work_dir(Config)}),
|
||||||
Config.
|
[{apps, Apps} | Config].
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:stop_apps([]),
|
emqx_cth_suite:stop(proplists:get_value(apps, Config)).
|
||||||
ok.
|
|
||||||
|
|
||||||
t_check_pub(_) ->
|
t_check_pub(_) ->
|
||||||
OldConf = emqx:get_config([zones], #{}),
|
OldConf = emqx:get_config([zones], #{}),
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
-compile(export_all).
|
-compile(export_all).
|
||||||
-compile(nowarn_export_all).
|
-compile(nowarn_export_all).
|
||||||
|
|
||||||
-include_lib("emqx/include/emqx.hrl").
|
|
||||||
-include_lib("emqx/include/emqx_mqtt.hrl").
|
-include_lib("emqx/include/emqx_mqtt.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
|
||||||
|
@ -59,31 +58,17 @@ groups() ->
|
||||||
].
|
].
|
||||||
|
|
||||||
init_per_group(tcp, Config) ->
|
init_per_group(tcp, Config) ->
|
||||||
emqx_common_test_helpers:start_apps([]),
|
Apps = emqx_cth_suite:start([emqx], #{work_dir => emqx_cth_suite:work_dir(Config)}),
|
||||||
[{port, 1883}, {conn_fun, connect} | Config];
|
[{port, 1883}, {conn_fun, connect}, {group_apps, Apps} | Config];
|
||||||
init_per_group(quic, Config) ->
|
init_per_group(quic, Config) ->
|
||||||
UdpPort = 1884,
|
Apps = emqx_cth_suite:start(
|
||||||
emqx_common_test_helpers:start_apps([]),
|
[{emqx, "listeners.quic.test { enable = true, bind = 1884 }"}],
|
||||||
emqx_common_test_helpers:ensure_quic_listener(?MODULE, UdpPort),
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
[{port, UdpPort}, {conn_fun, quic_connect} | Config];
|
),
|
||||||
init_per_group(_, Config) ->
|
[{port, 1884}, {conn_fun, quic_connect}, {group_apps, Apps} | Config].
|
||||||
emqx_common_test_helpers:stop_apps([]),
|
|
||||||
Config.
|
|
||||||
|
|
||||||
end_per_group(quic, _Config) ->
|
end_per_group(_Group, Config) ->
|
||||||
emqx_config:put([listeners, quic], #{}),
|
emqx_cth_suite:stop(?config(group_apps, Config)).
|
||||||
ok;
|
|
||||||
end_per_group(_Group, _Config) ->
|
|
||||||
ok.
|
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
|
||||||
%% Start Apps
|
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
|
||||||
emqx_common_test_helpers:start_apps([]),
|
|
||||||
Config.
|
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
|
||||||
emqx_common_test_helpers:stop_apps([]).
|
|
||||||
|
|
||||||
init_per_testcase(TestCase, Config) ->
|
init_per_testcase(TestCase, Config) ->
|
||||||
case erlang:function_exported(?MODULE, TestCase, 2) of
|
case erlang:function_exported(?MODULE, TestCase, 2) of
|
||||||
|
|
|
@ -26,14 +26,13 @@
|
||||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
Apps = emqx_cth_suite:start([emqx], #{work_dir => emqx_cth_suite:work_dir(Config)}),
|
||||||
emqx_common_test_helpers:start_apps([]),
|
|
||||||
OldSch = erlang:system_flag(schedulers_online, 1),
|
OldSch = erlang:system_flag(schedulers_online, 1),
|
||||||
[{old_sch, OldSch} | Config].
|
[{apps, Apps}, {old_sch, OldSch} | Config].
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
erlang:system_flag(schedulers_online, ?config(old_sch, Config)),
|
erlang:system_flag(schedulers_online, ?config(old_sch, Config)),
|
||||||
emqx_common_test_helpers:stop_apps([]).
|
emqx_cth_suite:stop(?config(apps, Config)).
|
||||||
|
|
||||||
init_per_testcase(_, Config) ->
|
init_per_testcase(_, Config) ->
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
emqx_common_test_helpers:boot_modules(all),
|
||||||
|
|
|
@ -24,12 +24,11 @@
|
||||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
Apps = emqx_cth_suite:start([emqx], #{work_dir => emqx_cth_suite:work_dir(Config)}),
|
||||||
emqx_common_test_helpers:start_apps([]),
|
[{apps, Apps} | Config].
|
||||||
Config.
|
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(Config) ->
|
||||||
emqx_common_test_helpers:stop_apps([]).
|
emqx_cth_suite:stop(proplists:get_value(apps, Config)).
|
||||||
|
|
||||||
init_per_testcase(t_cpu_check_alarm, Config) ->
|
init_per_testcase(t_cpu_check_alarm, Config) ->
|
||||||
SysMon = emqx_config:get([sysmon, os], #{}),
|
SysMon = emqx_config:get([sysmon, os], #{}),
|
||||||
|
|
Loading…
Reference in New Issue