test(ds): Don't start raft explicitly

This commit is contained in:
ieQu1 2024-06-18 00:12:31 +02:00
parent 3851fc189f
commit b2f7815a7f
No known key found for this signature in database
GPG Key ID: 488654DF3FED6FDE
11 changed files with 66 additions and 24 deletions

View File

@ -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)},

View File

@ -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"}}},

View File

@ -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,

View File

@ -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
];

View File

@ -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),

View File

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

View File

@ -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.

View File

@ -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, []}
]}.

View File

@ -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, []}
]}.

View File

@ -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]),

View File

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