Jelajahi Sumber

test(mgmt): better isolate testsuite running environments

Andrew Mayorov 1 tahun lalu
induk
melakukan
d47bf8076a

+ 11 - 4
apps/emqx_management/test/emqx_mgmt_api_publish_SUITE.erl

@@ -29,11 +29,18 @@ all() ->
     emqx_common_test_helpers:all(?MODULE).
     emqx_common_test_helpers:all(?MODULE).
 
 
 init_per_suite(Config) ->
 init_per_suite(Config) ->
-    emqx_mgmt_api_test_util:init_suite(),
-    Config.
+    Apps = emqx_cth_suite:start(
+        [
+            emqx,
+            emqx_management,
+            emqx_mgmt_api_test_util:emqx_dashboard()
+        ],
+        #{work_dir => emqx_cth_suite:work_dir(Config)}
+    ),
+    [{apps, Apps} | Config].
 
 
-end_per_suite(_) ->
-    emqx_mgmt_api_test_util:end_suite().
+end_per_suite(Config) ->
+    ok = emqx_cth_suite:stop(?config(apps, Config)).
 
 
 init_per_testcase(Case, Config) ->
 init_per_testcase(Case, Config) ->
     ?MODULE:Case({init, Config}).
     ?MODULE:Case({init, Config}).

+ 0 - 1
apps/emqx_management/test/emqx_mgmt_api_stats_SUITE.erl

@@ -33,7 +33,6 @@ init_per_suite(Config) ->
         ],
         ],
         #{work_dir => emqx_cth_suite:work_dir(Config)}
         #{work_dir => emqx_cth_suite:work_dir(Config)}
     ),
     ),
-    {ok, _Api} = emqx_common_test_http:create_default_app(),
     [{apps, Apps} | Config].
     [{apps, Apps} | Config].
 
 
 end_per_suite(Config) ->
 end_per_suite(Config) ->

+ 11 - 4
apps/emqx_management/test/emqx_mgmt_api_status_SUITE.erl

@@ -51,11 +51,18 @@ groups() ->
     ].
     ].
 
 
 init_per_suite(Config) ->
 init_per_suite(Config) ->
-    emqx_mgmt_api_test_util:init_suite(),
-    Config.
+    Apps = emqx_cth_suite:start(
+        [
+            emqx,
+            emqx_management,
+            emqx_mgmt_api_test_util:emqx_dashboard()
+        ],
+        #{work_dir => emqx_cth_suite:work_dir(Config)}
+    ),
+    [{apps, Apps} | Config].
 
 
-end_per_suite(_) ->
-    emqx_mgmt_api_test_util:end_suite().
+end_per_suite(Config) ->
+    ok = emqx_cth_suite:stop(?config(apps, Config)).
 
 
 init_per_group(api_status_endpoint, Config) ->
 init_per_group(api_status_endpoint, Config) ->
     [{get_status_path, ["api", "v5", "status"]} | Config];
     [{get_status_path, ["api", "v5", "status"]} | Config];

+ 11 - 4
apps/emqx_management/test/emqx_mgmt_cli_SUITE.erl

@@ -25,12 +25,19 @@ all() ->
     emqx_common_test_helpers:all(?MODULE).
     emqx_common_test_helpers:all(?MODULE).
 
 
 init_per_suite(Config) ->
 init_per_suite(Config) ->
-    emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_management]),
+    Apps = emqx_cth_suite:start(
+        [
+            emqx_conf,
+            emqx_management,
+            emqx_mgmt_api_test_util:emqx_dashboard()
+        ],
+        #{work_dir => emqx_cth_suite:work_dir(Config)}
+    ),
     ok = emqx_mgmt_cli:load(),
     ok = emqx_mgmt_cli:load(),
-    Config.
+    [{apps, Apps} | Config].
 
 
-end_per_suite(_) ->
-    emqx_mgmt_api_test_util:end_suite([emqx_management, emqx_conf]).
+end_per_suite(Config) ->
+    ok = emqx_cth_suite:stop(?config(apps, Config)).
 
 
 init_per_testcase(t_autocluster_leave = TC, Config) ->
 init_per_testcase(t_autocluster_leave = TC, Config) ->
     [Core1, Core2, Repl1, Repl2] =
     [Core1, Core2, Repl1, Repl2] =