فهرست منبع

test(refactor): move test to integration tests dir

Thales Macedo Garitezi 2 سال پیش
والد
کامیت
ee2897e5de

apps/emqx_durable_storage/test/emqx_ds_SUITE.erl → apps/emqx/integration_test/emqx_ds_SUITE.erl


+ 7 - 1
apps/emqx/test/emqx_cth_suite.erl

@@ -101,7 +101,13 @@ when
         %% function will raise an error.
         work_dir := file:name()
     }.
-start(Apps, SuiteOpts = #{work_dir := WorkDir}) ->
+start(Apps, SuiteOpts0 = #{work_dir := WorkDir0}) ->
+    %% when running CT on the whole app, it seems like `priv_dir` is the same on all
+    %% suites and leads to the "clean slate" verificatin to fail.
+    WorkDir = binary_to_list(
+        filename:join([WorkDir0, emqx_guid:to_hexstr(emqx_guid:gen())])
+    ),
+    SuiteOpts = SuiteOpts0#{work_dir := WorkDir},
     % 1. Prepare appspec instructions
     AppSpecs = [mk_appspec(App, SuiteOpts) || App <- Apps],
     % 2. Load every app so that stuff scanning attributes of loaded modules works

+ 6 - 1
apps/emqx/test/emqx_persistent_messages_SUITE.erl

@@ -29,9 +29,14 @@ all() ->
     emqx_common_test_helpers:all(?MODULE).
 
 init_per_suite(Config) ->
+    %% avoid inter-suite flakiness...
+    %% TODO: remove after other suites start to use `emx_cth_suite'
+    application:stop(emqx),
+    application:stop(emqx_durable_storage),
+    WorkDir = ?config(priv_dir, Config),
     TCApps = emqx_cth_suite:start(
         app_specs(),
-        #{work_dir => ?config(priv_dir, Config)}
+        #{work_dir => WorkDir}
     ),
     [{tc_apps, TCApps} | Config].