test: Disable certain DS-related suites in CE

This commit is contained in:
ieQu1 2024-06-18 05:31:44 +02:00
parent 1d3b1868fb
commit 8aa27488b6
No known key found for this signature in database
GPG Key ID: 488654DF3FED6FDE
7 changed files with 98 additions and 92 deletions

View File

@ -25,11 +25,16 @@ all() ->
emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) ->
case emqx_ds_test_helpers:skip_if_norepl() of
false ->
TCApps = emqx_cth_suite:start(
app_specs(),
#{work_dir => emqx_cth_suite:work_dir(Config)}
),
[{tc_apps, TCApps} | Config].
[{tc_apps, TCApps} | Config];
Yes ->
Yes
end.
end_per_suite(Config) ->
TCApps = ?config(tc_apps, Config),
@ -60,8 +65,7 @@ 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"
"durable_storage.messages.backend = builtin_local\n"
"\n }"
},
Cluster = cluster(Opts),
ClusterOpts = #{work_dir => emqx_cth_suite:work_dir(TestCase, Config)},

View File

@ -33,11 +33,11 @@ all() ->
emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) ->
case is_standalone() of
true ->
{skip, standalone_not_supported};
case emqx_ds_test_helpers:skip_if_norepl() of
false ->
Config
Config;
Yes ->
Yes
end.
end_per_suite(_Config) ->
@ -595,11 +595,3 @@ on_message_dropped(Msg, Context, Res, TestPid) ->
ErrCtx = #{msg => Msg, ctx => Context, res => Res},
ct:pal("this hook should not be called.\n ~p", [ErrCtx]),
exit(TestPid, {hookpoint_called, ErrCtx}).
is_standalone() ->
try
emqx_conf:module_info(),
false
catch
error:undef -> true
end.

View File

@ -56,18 +56,11 @@
%% 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),
@ -89,6 +82,8 @@ end_per_suite(_Config) ->
ok.
init_per_group(persistent_sessions = Group, Config) ->
case emqx_ds_test_helpers:skip_if_norepl() of
false ->
AppSpecsFn = fun(Enable) ->
Port =
case Enable of
@ -120,6 +115,9 @@ init_per_group(persistent_sessions = Group, Config) ->
),
?ON(N1, {ok, _} = emqx_common_test_http:create_default_app()),
[{cluster, Nodes} | Config];
Yes ->
Yes
end;
init_per_group(common = Group, Config) ->
Apps = emqx_cth_suite:start(
[

View File

@ -550,19 +550,9 @@ delete(DB, It0, Selector, BatchSize, Acc) ->
%% CT callbacks
-if(?EMQX_RELEASE_EDITION == ee).
all() ->
[{group, builtin_local}, {group, builtin_raft}].
%% kernel-10 OTP application (OTP 27) introduces
%% `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:
-else.
all() ->
[{group, builtin_local}].
-endif.
groups() ->
TCs = emqx_common_test_helpers:all(?MODULE),
[
@ -578,6 +568,8 @@ init_per_group(builtin_local, Config) ->
},
[{ds_conf, Conf} | Config];
init_per_group(builtin_raft, Config) ->
case emqx_ds_test_helpers:skip_if_norepl() of
false ->
Conf = #{
backend => builtin_raft,
storage => {emqx_ds_storage_reference, #{}},
@ -586,7 +578,10 @@ init_per_group(builtin_raft, Config) ->
replication_factor => 3,
replication_options => #{}
},
[{ds_conf, Conf} | Config].
[{ds_conf, Conf} | Config];
Yes ->
Yes
end.
end_per_group(_Group, Config) ->
Config.

View File

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

View File

@ -26,6 +26,17 @@
emqx_ds_test_helpers:on(NODE, fun() -> BODY end)
).
skip_if_norepl() ->
try emqx_release:edition() of
ee ->
false;
_ ->
{skip, no_ds_replication}
catch
error:undef ->
{skip, standalone_not_supported}
end.
-spec on([node()] | node(), fun(() -> A)) -> A | [A].
on(Node, Fun) when is_atom(Node) ->
[Ret] = on([Node], Fun),

View File

@ -56,6 +56,8 @@ init_per_group(persistence_disabled, Config) ->
| Config
];
init_per_group(persistence_enabled, Config) ->
case emqx_ds_test_helpers:skip_if_norepl() of
false ->
Apps = emqx_cth_suite:start(
[
{emqx,
@ -72,6 +74,9 @@ init_per_group(persistence_enabled, Config) ->
{apps, Apps}
| Config
];
Yes ->
Yes
end;
init_per_group(cm_registry_enabled, Config) ->
[{emqx_config, "broker.enable_session_registry = true"} | Config];
init_per_group(cm_registry_disabled, Config) ->