fix(test): switch `emqx_flapping_SUITE` to cth tooling

This commit is contained in:
Andrew Mayorov 2023-08-15 21:29:42 +04:00
parent 5560e6ed4f
commit 0b21b87296
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 15 additions and 19 deletions

View File

@ -20,31 +20,27 @@
-compile(nowarn_export_all). -compile(nowarn_export_all).
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
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_common_test_helpers:start_apps([]), [
%% update global default config {emqx,
{ok, _} = emqx:update_config( "flapping_detect {"
[flapping_detect], "\n enable = true"
#{ "\n max_count = 3"
<<"enable">> => true, "\n window_time = 100ms"
<<"max_count">> => 3, "\n ban_time = 2s"
% 0.1s "\n }"}
<<"window_time">> => <<"100ms">>, ],
%% 2s #{work_dir => ?config(priv_dir, Config)}
<<"ban_time">> => <<"2s">>
}
), ),
Config. [{suite_apps, Apps} | Config].
end_per_suite(_Config) -> end_per_suite(Config) ->
emqx_common_test_helpers:stop_apps([]), emqx_cth_suite:stop(?config(suite_apps, Config)).
%% Clean emqx_banned table
mria_mnesia:delete_schema(),
ok.
t_detect_check(_) -> t_detect_check(_) ->
ClientInfo = #{ ClientInfo = #{