Kaynağa Gözat

test(ds): Don't start raft explicitly

ieQu1 1 yıl önce
ebeveyn
işleme
b2f7815a7f

+ 2 - 1
apps/emqx/integration_test/emqx_persistent_session_ds_SUITE.erl

@@ -60,7 +60,8 @@ init_per_testcase(t_session_gc = TestCase, Config) ->
             "\n   heartbeat_interval = 500ms "
             "\n   session_gc_interval = 1s "
             "\n   session_gc_batch_size = 2 "
-            "\n }"
+            "\n }\n"
+            "durable_storage.messages.backend = builtin_local\n"
     },
     Cluster = cluster(Opts),
     ClusterOpts = #{work_dir => emqx_cth_suite:work_dir(TestCase, Config)},

+ 0 - 1
apps/emqx/rebar.config

@@ -24,7 +24,6 @@
 {deps, [
     {emqx_utils, {path, "../emqx_utils"}},
     {emqx_durable_storage, {path, "../emqx_durable_storage"}},
-    {emqx_ds_builtin_local, {path, "../emqx_ds_builtin_local"}},
     {emqx_ds_backends, {path, "../emqx_ds_backends"}},
     {lc, {git, "https://github.com/emqx/lc.git", {tag, "0.3.2"}}},
     {gproc, {git, "https://github.com/emqx/gproc", {tag, "0.9.0.1"}}},

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

@@ -470,7 +470,7 @@ t_metrics_not_dropped(_Config) ->
 t_replication_options(_Config) ->
     ?assertMatch(
         #{
-            backend := builtin,
+            backend := builtin_raft,
             replication_options := #{
                 wal_max_size_bytes := 16000000,
                 wal_max_batch_size := 1024,

+ 2 - 1
apps/emqx/test/emqx_persistent_session_SUITE.erl

@@ -81,7 +81,8 @@ init_per_group(persistence_enabled, Config) ->
                 "  heartbeat_interval = 100ms\n"
                 "  renew_streams_interval = 100ms\n"
                 "  session_gc_interval = 2s\n"
-                "}"},
+                "}\n"
+                "durable_storage.messages.backend = builtin_local"},
         {persistence, ds}
         | Config
     ];

+ 7 - 0
apps/emqx_dashboard/test/emqx_dashboard_monitor_SUITE.erl

@@ -56,11 +56,18 @@
 %% CT boilerplate
 %%--------------------------------------------------------------------
 
+-if(?EMQX_RELEASE_EDITION == ee).
 all() ->
     [
         {group, common},
         {group, persistent_sessions}
     ].
+-else.
+all() ->
+    [
+        {group, common}
+    ].
+-endif.
 
 groups() ->
     AllTCs = emqx_common_test_helpers:all(?MODULE),

+ 0 - 5
apps/emqx_ds_backends/rebar.config

@@ -1,5 +0,0 @@
-%% -*- mode:erlang -*-
-{deps, [
-    {emqx_utils, {path, "../emqx_utils"}},
-    {emqx_durable_storage, {path, "../emqx_durable_storage"}}
-]}.

+ 26 - 0
apps/emqx_ds_backends/rebar.config.script

@@ -0,0 +1,26 @@
+%% -*- mode:erlang -*-
+Profile = case os:getenv("PROFILE") of
+            "emqx-enterprise" ++ _ ->
+              ee;
+            false ->
+              io:format(user, "WARN: environment variable PROFILE is not set, using 'emqx-enterprise'~n", []),
+              ee;
+            _ ->
+              ce
+          end,
+CEDeps =
+    [
+        {emqx_utils, {path, "../emqx_utils"}},
+        {emqx_durable_storage, {path, "../emqx_durable_storage"}},
+        {emqx_ds_builtin_local, {path, "../emqx_ds_builtin_local"}}
+    ],
+EEDeps =
+    [
+        {emqx_ds_builtin_raft, {path, "../emqx_ds_builtin_raft"}}
+    ],
+case Profile of
+  ee ->
+    {deps, CEDeps ++ EEDeps};
+  ce ->
+    {deps, CEDeps}
+end.

+ 0 - 11
apps/emqx_ds_backends/src/emqx_ds_backends.app.src

@@ -1,11 +0,0 @@
-%% -*- mode: erlang -*-
-{application, emqx_ds_backends, [
-    {description, "A placeholder application that depends on all available DS backends"},
-    % strict semver, bump manually!
-    {vsn, "0.1.0"},
-    {modules, []},
-    {registered, []},
-    {applications, [kernel, stdlib, emqx_durable_storage, emqx_ds_builtin_local]},
-    {optional_applications, [emqx_ds_builtin_raft]},
-    {env, []}
-]}.

+ 26 - 0
apps/emqx_ds_backends/src/emqx_ds_backends.app.src.script

@@ -0,0 +1,26 @@
+%% -*- mode: erlang -*-
+Profile = case os:getenv("PROFILE") of
+            "emqx-enterprise" ++ _ ->
+              ee;
+            false ->
+              io:format(user, "WARN: environment variable PROFILE is not set, using 'emqx-enterprise'~n", []),
+              ee;
+            _ ->
+              ce
+          end,
+
+{application, emqx_ds_backends, [
+    {description, "A placeholder application that depends on all available DS backends"},
+    % strict semver, bump manually!
+    {vsn, "0.1.0"},
+    {modules, []},
+    {registered, []},
+    {applications, [kernel, stdlib, emqx_durable_storage, emqx_ds_builtin_local |
+                    case Profile of
+                      ee ->
+                          [emqx_ds_builtin_raft];
+                      ce ->
+                          []
+                    end]},
+    {env, []}
+]}.

+ 1 - 4
apps/emqx_ds_backends/test/emqx_ds_backends_SUITE.erl

@@ -558,12 +558,9 @@ all() ->
 %% `optional_applications` application spec flag. Once we migrate to
 %% OTP27, this won't be needed, as application controller will
 %% automatically load raft backend when available:
--define(MAYBE_RAFT, [emqx_ds_builtin_raft]).
 -else.
 all() ->
     [{group, builtin_local}].
-
--define(MAYBE_RAFT, []).
 -endif.
 
 groups() ->
@@ -602,7 +599,7 @@ end_per_suite(_Config) ->
 
 init_per_testcase(TC, Config) ->
     Apps = emqx_cth_suite:start(
-        [emqx_durable_storage, emqx_ds_backends | ?MAYBE_RAFT],
+        [emqx_durable_storage, emqx_ds_backends],
         #{work_dir => emqx_cth_suite:work_dir(TC, Config)}
     ),
     ct:pal("Apps: ~p", [Apps]),

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

@@ -52,6 +52,7 @@ persistent_session_testcases() ->
         t_persistent_sessions_subscriptions1,
         t_list_clients_v2
     ].
+
 client_msgs_testcases() ->
     [
         t_inflight_messages,