test: Disable certain DS-related suites in CE
This commit is contained in:
parent
1d3b1868fb
commit
8aa27488b6
|
@ -25,11 +25,16 @@ all() ->
|
|||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
TCApps = emqx_cth_suite:start(
|
||||
app_specs(),
|
||||
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||
),
|
||||
[{tc_apps, TCApps} | 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];
|
||||
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)},
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,37 +82,42 @@ end_per_suite(_Config) ->
|
|||
ok.
|
||||
|
||||
init_per_group(persistent_sessions = Group, Config) ->
|
||||
AppSpecsFn = fun(Enable) ->
|
||||
Port =
|
||||
case Enable of
|
||||
true -> "18083";
|
||||
false -> "0"
|
||||
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||
false ->
|
||||
AppSpecsFn = fun(Enable) ->
|
||||
Port =
|
||||
case Enable of
|
||||
true -> "18083";
|
||||
false -> "0"
|
||||
end,
|
||||
[
|
||||
emqx_conf,
|
||||
{emqx, "durable_sessions {enable = true}"},
|
||||
{emqx_retainer, ?BASE_RETAINER_CONF},
|
||||
emqx_management,
|
||||
emqx_mgmt_api_test_util:emqx_dashboard(
|
||||
lists:concat([
|
||||
"dashboard.listeners.http { bind = " ++ Port ++ " }\n",
|
||||
"dashboard.sample_interval = 1s\n",
|
||||
"dashboard.listeners.http.enable = " ++ atom_to_list(Enable)
|
||||
])
|
||||
)
|
||||
]
|
||||
end,
|
||||
[
|
||||
emqx_conf,
|
||||
{emqx, "durable_sessions {enable = true}"},
|
||||
{emqx_retainer, ?BASE_RETAINER_CONF},
|
||||
emqx_management,
|
||||
emqx_mgmt_api_test_util:emqx_dashboard(
|
||||
lists:concat([
|
||||
"dashboard.listeners.http { bind = " ++ Port ++ " }\n",
|
||||
"dashboard.sample_interval = 1s\n",
|
||||
"dashboard.listeners.http.enable = " ++ atom_to_list(Enable)
|
||||
])
|
||||
)
|
||||
]
|
||||
end,
|
||||
NodeSpecs = [
|
||||
{dashboard_monitor1, #{apps => AppSpecsFn(true)}},
|
||||
{dashboard_monitor2, #{apps => AppSpecsFn(false)}}
|
||||
],
|
||||
Nodes =
|
||||
[N1 | _] = emqx_cth_cluster:start(
|
||||
NodeSpecs,
|
||||
#{work_dir => emqx_cth_suite:work_dir(Group, Config)}
|
||||
),
|
||||
?ON(N1, {ok, _} = emqx_common_test_http:create_default_app()),
|
||||
[{cluster, Nodes} | Config];
|
||||
NodeSpecs = [
|
||||
{dashboard_monitor1, #{apps => AppSpecsFn(true)}},
|
||||
{dashboard_monitor2, #{apps => AppSpecsFn(false)}}
|
||||
],
|
||||
Nodes =
|
||||
[N1 | _] = emqx_cth_cluster:start(
|
||||
NodeSpecs,
|
||||
#{work_dir => emqx_cth_suite:work_dir(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(
|
||||
[
|
||||
|
|
|
@ -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,15 +568,20 @@ init_per_group(builtin_local, Config) ->
|
|||
},
|
||||
[{ds_conf, Conf} | Config];
|
||||
init_per_group(builtin_raft, Config) ->
|
||||
Conf = #{
|
||||
backend => builtin_raft,
|
||||
storage => {emqx_ds_storage_reference, #{}},
|
||||
n_shards => ?N_SHARDS,
|
||||
n_sites => 1,
|
||||
replication_factor => 3,
|
||||
replication_options => #{}
|
||||
},
|
||||
[{ds_conf, Conf} | Config].
|
||||
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||
false ->
|
||||
Conf = #{
|
||||
backend => builtin_raft,
|
||||
storage => {emqx_ds_storage_reference, #{}},
|
||||
n_shards => ?N_SHARDS,
|
||||
n_sites => 1,
|
||||
replication_factor => 3,
|
||||
replication_options => #{}
|
||||
},
|
||||
[{ds_conf, Conf} | Config];
|
||||
Yes ->
|
||||
Yes
|
||||
end.
|
||||
|
||||
end_per_group(_Group, Config) ->
|
||||
Config.
|
||||
|
|
|
@ -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"}
|
||||
]}.
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -56,22 +56,27 @@ init_per_group(persistence_disabled, Config) ->
|
|||
| Config
|
||||
];
|
||||
init_per_group(persistence_enabled, Config) ->
|
||||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
{emqx,
|
||||
"durable_sessions {\n"
|
||||
" enable = true\n"
|
||||
" heartbeat_interval = 100ms\n"
|
||||
" renew_streams_interval = 100ms\n"
|
||||
"}"},
|
||||
emqx_management
|
||||
],
|
||||
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||
),
|
||||
[
|
||||
{apps, Apps}
|
||||
| Config
|
||||
];
|
||||
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||
false ->
|
||||
Apps = emqx_cth_suite:start(
|
||||
[
|
||||
{emqx,
|
||||
"durable_sessions {\n"
|
||||
" enable = true\n"
|
||||
" heartbeat_interval = 100ms\n"
|
||||
" renew_streams_interval = 100ms\n"
|
||||
"}"},
|
||||
emqx_management
|
||||
],
|
||||
#{work_dir => emqx_cth_suite:work_dir(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) ->
|
||||
|
|
Loading…
Reference in New Issue