Просмотр исходного кода

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

Andrew Mayorov 2 лет назад
Родитель
Сommit
0b21b87296
1 измененных файлов с 15 добавлено и 19 удалено
  1. 15 19
      apps/emqx/test/emqx_flapping_SUITE.erl

+ 15 - 19
apps/emqx/test/emqx_flapping_SUITE.erl

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