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).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
TCApps = emqx_cth_suite:start(
|
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||||
app_specs(),
|
false ->
|
||||||
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
TCApps = emqx_cth_suite:start(
|
||||||
),
|
app_specs(),
|
||||||
[{tc_apps, TCApps} | Config].
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
|
),
|
||||||
|
[{tc_apps, TCApps} | Config];
|
||||||
|
Yes ->
|
||||||
|
Yes
|
||||||
|
end.
|
||||||
|
|
||||||
end_per_suite(Config) ->
|
end_per_suite(Config) ->
|
||||||
TCApps = ?config(tc_apps, Config),
|
TCApps = ?config(tc_apps, Config),
|
||||||
|
@ -60,8 +65,7 @@ init_per_testcase(t_session_gc = TestCase, Config) ->
|
||||||
"\n heartbeat_interval = 500ms "
|
"\n heartbeat_interval = 500ms "
|
||||||
"\n session_gc_interval = 1s "
|
"\n session_gc_interval = 1s "
|
||||||
"\n session_gc_batch_size = 2 "
|
"\n session_gc_batch_size = 2 "
|
||||||
"\n }\n"
|
"\n }"
|
||||||
"durable_storage.messages.backend = builtin_local\n"
|
|
||||||
},
|
},
|
||||||
Cluster = cluster(Opts),
|
Cluster = cluster(Opts),
|
||||||
ClusterOpts = #{work_dir => emqx_cth_suite:work_dir(TestCase, Config)},
|
ClusterOpts = #{work_dir => emqx_cth_suite:work_dir(TestCase, Config)},
|
||||||
|
|
|
@ -33,11 +33,11 @@ all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
case is_standalone() of
|
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||||
true ->
|
|
||||||
{skip, standalone_not_supported};
|
|
||||||
false ->
|
false ->
|
||||||
Config
|
Config;
|
||||||
|
Yes ->
|
||||||
|
Yes
|
||||||
end.
|
end.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
|
@ -595,11 +595,3 @@ on_message_dropped(Msg, Context, Res, TestPid) ->
|
||||||
ErrCtx = #{msg => Msg, ctx => Context, res => Res},
|
ErrCtx = #{msg => Msg, ctx => Context, res => Res},
|
||||||
ct:pal("this hook should not be called.\n ~p", [ErrCtx]),
|
ct:pal("this hook should not be called.\n ~p", [ErrCtx]),
|
||||||
exit(TestPid, {hookpoint_called, 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
|
%% CT boilerplate
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
-if(?EMQX_RELEASE_EDITION == ee).
|
|
||||||
all() ->
|
all() ->
|
||||||
[
|
[
|
||||||
{group, common},
|
{group, common},
|
||||||
{group, persistent_sessions}
|
{group, persistent_sessions}
|
||||||
].
|
].
|
||||||
-else.
|
|
||||||
all() ->
|
|
||||||
[
|
|
||||||
{group, common}
|
|
||||||
].
|
|
||||||
-endif.
|
|
||||||
|
|
||||||
groups() ->
|
groups() ->
|
||||||
AllTCs = emqx_common_test_helpers:all(?MODULE),
|
AllTCs = emqx_common_test_helpers:all(?MODULE),
|
||||||
|
@ -89,37 +82,42 @@ end_per_suite(_Config) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
init_per_group(persistent_sessions = Group, Config) ->
|
init_per_group(persistent_sessions = Group, Config) ->
|
||||||
AppSpecsFn = fun(Enable) ->
|
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||||
Port =
|
false ->
|
||||||
case Enable of
|
AppSpecsFn = fun(Enable) ->
|
||||||
true -> "18083";
|
Port =
|
||||||
false -> "0"
|
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,
|
end,
|
||||||
[
|
NodeSpecs = [
|
||||||
emqx_conf,
|
{dashboard_monitor1, #{apps => AppSpecsFn(true)}},
|
||||||
{emqx, "durable_sessions {enable = true}"},
|
{dashboard_monitor2, #{apps => AppSpecsFn(false)}}
|
||||||
{emqx_retainer, ?BASE_RETAINER_CONF},
|
],
|
||||||
emqx_management,
|
Nodes =
|
||||||
emqx_mgmt_api_test_util:emqx_dashboard(
|
[N1 | _] = emqx_cth_cluster:start(
|
||||||
lists:concat([
|
NodeSpecs,
|
||||||
"dashboard.listeners.http { bind = " ++ Port ++ " }\n",
|
#{work_dir => emqx_cth_suite:work_dir(Group, Config)}
|
||||||
"dashboard.sample_interval = 1s\n",
|
),
|
||||||
"dashboard.listeners.http.enable = " ++ atom_to_list(Enable)
|
?ON(N1, {ok, _} = emqx_common_test_http:create_default_app()),
|
||||||
])
|
[{cluster, Nodes} | Config];
|
||||||
)
|
Yes ->
|
||||||
]
|
Yes
|
||||||
end,
|
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];
|
|
||||||
init_per_group(common = Group, Config) ->
|
init_per_group(common = Group, Config) ->
|
||||||
Apps = emqx_cth_suite:start(
|
Apps = emqx_cth_suite:start(
|
||||||
[
|
[
|
||||||
|
|
|
@ -550,19 +550,9 @@ delete(DB, It0, Selector, BatchSize, Acc) ->
|
||||||
|
|
||||||
%% CT callbacks
|
%% CT callbacks
|
||||||
|
|
||||||
-if(?EMQX_RELEASE_EDITION == ee).
|
|
||||||
all() ->
|
all() ->
|
||||||
[{group, builtin_local}, {group, builtin_raft}].
|
[{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() ->
|
groups() ->
|
||||||
TCs = emqx_common_test_helpers:all(?MODULE),
|
TCs = emqx_common_test_helpers:all(?MODULE),
|
||||||
[
|
[
|
||||||
|
@ -578,15 +568,20 @@ init_per_group(builtin_local, Config) ->
|
||||||
},
|
},
|
||||||
[{ds_conf, Conf} | Config];
|
[{ds_conf, Conf} | Config];
|
||||||
init_per_group(builtin_raft, Config) ->
|
init_per_group(builtin_raft, Config) ->
|
||||||
Conf = #{
|
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||||
backend => builtin_raft,
|
false ->
|
||||||
storage => {emqx_ds_storage_reference, #{}},
|
Conf = #{
|
||||||
n_shards => ?N_SHARDS,
|
backend => builtin_raft,
|
||||||
n_sites => 1,
|
storage => {emqx_ds_storage_reference, #{}},
|
||||||
replication_factor => 3,
|
n_shards => ?N_SHARDS,
|
||||||
replication_options => #{}
|
n_sites => 1,
|
||||||
},
|
replication_factor => 3,
|
||||||
[{ds_conf, Conf} | Config].
|
replication_options => #{}
|
||||||
|
},
|
||||||
|
[{ds_conf, Conf} | Config];
|
||||||
|
Yes ->
|
||||||
|
Yes
|
||||||
|
end.
|
||||||
|
|
||||||
end_per_group(_Group, Config) ->
|
end_per_group(_Group, Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
%% -*- mode:erlang -*-
|
%% -*- mode:erlang -*-
|
||||||
|
|
||||||
{deps, [
|
{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)
|
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].
|
-spec on([node()] | node(), fun(() -> A)) -> A | [A].
|
||||||
on(Node, Fun) when is_atom(Node) ->
|
on(Node, Fun) when is_atom(Node) ->
|
||||||
[Ret] = on([Node], Fun),
|
[Ret] = on([Node], Fun),
|
||||||
|
|
|
@ -56,22 +56,27 @@ init_per_group(persistence_disabled, Config) ->
|
||||||
| Config
|
| Config
|
||||||
];
|
];
|
||||||
init_per_group(persistence_enabled, Config) ->
|
init_per_group(persistence_enabled, Config) ->
|
||||||
Apps = emqx_cth_suite:start(
|
case emqx_ds_test_helpers:skip_if_norepl() of
|
||||||
[
|
false ->
|
||||||
{emqx,
|
Apps = emqx_cth_suite:start(
|
||||||
"durable_sessions {\n"
|
[
|
||||||
" enable = true\n"
|
{emqx,
|
||||||
" heartbeat_interval = 100ms\n"
|
"durable_sessions {\n"
|
||||||
" renew_streams_interval = 100ms\n"
|
" enable = true\n"
|
||||||
"}"},
|
" heartbeat_interval = 100ms\n"
|
||||||
emqx_management
|
" renew_streams_interval = 100ms\n"
|
||||||
],
|
"}"},
|
||||||
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
emqx_management
|
||||||
),
|
],
|
||||||
[
|
#{work_dir => emqx_cth_suite:work_dir(Config)}
|
||||||
{apps, Apps}
|
),
|
||||||
| Config
|
[
|
||||||
];
|
{apps, Apps}
|
||||||
|
| Config
|
||||||
|
];
|
||||||
|
Yes ->
|
||||||
|
Yes
|
||||||
|
end;
|
||||||
init_per_group(cm_registry_enabled, Config) ->
|
init_per_group(cm_registry_enabled, Config) ->
|
||||||
[{emqx_config, "broker.enable_session_registry = true"} | Config];
|
[{emqx_config, "broker.enable_session_registry = true"} | Config];
|
||||||
init_per_group(cm_registry_disabled, Config) ->
|
init_per_group(cm_registry_disabled, Config) ->
|
||||||
|
|
Loading…
Reference in New Issue