Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not update module config #3389

Merged
merged 9 commits into from
Nov 9, 2021
82 changes: 33 additions & 49 deletions big_tests/tests/bosh_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@
all() ->
[
{group, essential},

{group, essential_https},
{group, chat},
{group, chat_https},
{group, time},
{group, acks},

{group, essential_https},
{group, chat_https},
{group, server_acks},
{group, interleave_requests_statem}
].

Expand All @@ -55,6 +54,7 @@ groups() ->
{chat_https, [shuffle], chat_test_cases()},
{time, [parallel], time_test_cases()},
{acks, [shuffle], acks_test_cases()},
{server_acks, [], [server_acks]},
{interleave_requests_statem, [parallel], [interleave_requests_statem]}
].

Expand Down Expand Up @@ -94,7 +94,6 @@ time_test_cases() ->

acks_test_cases() ->
[
server_acks,
force_report,
force_retransmission,
force_cache_trimming
Expand All @@ -105,50 +104,59 @@ acks_test_cases() ->
%%--------------------------------------------------------------------

init_per_suite(Config) ->
dynamic_modules:save_modules(host_type(), Config),
escalus:init_per_suite([{escalus_user_db, {module, escalus_ejabberd}} | Config]).

end_per_suite(Config) ->
dynamic_modules:restore_modules(Config),
escalus_fresh:clean(),
escalus:end_per_suite(Config).

init_per_group(time, Config) ->
NewConfig = escalus_ejabberd:setup_option(max_wait(), Config),
escalus_ejabberd:setup_option(inactivity(), NewConfig);
dynamic_modules:ensure_modules(host_type(), required_modules(time)),
Config;
init_per_group(essential, Config) ->
dynamic_modules:ensure_modules(host_type(), required_modules(essential)),
[{user, carol} | Config];
init_per_group(essential_https, Config) ->
dynamic_modules:ensure_modules(host_type(), required_modules(essential_https)),
[{user, carol_s} | Config];
init_per_group(chat_https, Config) ->
dynamic_modules:ensure_modules(host_type(), required_modules(chat_https)),
Config1 = escalus:create_users(Config, escalus:get_users([carol, carol_s, geralt, alice])),
[{user, carol_s} | Config1];
init_per_group(_GroupName, Config) ->
init_per_group(GroupName, Config) ->
dynamic_modules:ensure_modules(host_type(), required_modules(GroupName)),
Config1 = escalus:create_users(Config, escalus:get_users([carol, carol_s, geralt, alice])),
[{user, carol} | Config1].

end_per_group(time, Config) ->
NewConfig = escalus_ejabberd:reset_option(max_wait(), Config),
escalus_ejabberd:reset_option(inactivity(), NewConfig);
end_per_group(GroupName, Config)
when GroupName =:= essential; GroupName =:= essential_https ->
Config;
end_per_group(GroupName, _Config) when GroupName =:= time;
GroupName =:= essential;
GroupName =:= essential_https ->
ok;
end_per_group(_GroupName, Config) ->
R = escalus:delete_users(Config, escalus:get_users([carol, carol_s, geralt, alice])),
mongoose_helper:clear_last_activity(Config, carol),
Config,
R.

init_per_testcase(server_acks = CaseName, Config) ->
NewConfig = escalus_ejabberd:setup_option(server_acks_opt(), Config),
escalus:init_per_testcase(CaseName, NewConfig);
escalus:delete_users(Config, escalus:get_users([carol, carol_s, geralt, alice])),
mongoose_helper:clear_last_activity(Config, carol).

init_per_testcase(CaseName, Config) ->
escalus:init_per_testcase(CaseName, Config).

end_per_testcase(server_acks = CaseName, Config) ->
NewConfig = escalus_ejabberd:reset_option(server_acks_opt(), Config),
escalus:end_per_testcase(CaseName, NewConfig);
end_per_testcase(CaseName, Config) ->
escalus:end_per_testcase(CaseName, Config).

%% Module configuration per group

required_modules(GroupName) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideal

[{mod_bosh, required_bosh_opts(GroupName)}].

required_bosh_opts(time) ->
[{max_wait, ?MAX_WAIT},
{inactivity, ?INACTIVITY}];
required_bosh_opts(server_acks) ->
[{server_acks, true}];
required_bosh_opts(_Group) ->
[].

%%--------------------------------------------------------------------
%% Tests
%%--------------------------------------------------------------------
Expand Down Expand Up @@ -844,30 +852,6 @@ set_client_acks(SessionPid, Enabled) ->
get_cached_responses(SessionPid) ->
rpc(mim(), mod_bosh_socket, get_cached_responses, [SessionPid]).

inactivity() ->
inactivity(?INACTIVITY).

inactivity(Value) ->
{inactivity,
fun() -> rpc(mim(), mod_bosh, get_inactivity, [host_type()]) end,
fun(V) -> rpc(mim(), mod_bosh, set_inactivity, [host_type(), V]) end,
Value}.

max_wait() ->
max_wait(?MAX_WAIT).

max_wait(Value) ->
{max_wait,
fun() -> rpc(mim(), mod_bosh, get_max_wait, [host_type()]) end,
fun(V) -> rpc(mim(), mod_bosh, set_max_wait, [host_type(), V]) end,
Value}.

server_acks_opt() ->
{server_acks,
fun() -> rpc(mim(), mod_bosh, get_server_acks, [host_type()]) end,
fun(V) -> rpc(mim(), mod_bosh, set_server_acks, [host_type(), V]) end,
true}.

is_session_alive(Sid) ->
BoshSessions = get_bosh_sessions(),
lists:keymember(Sid, 2, BoshSessions).
Expand Down
24 changes: 7 additions & 17 deletions big_tests/tests/mod_global_distrib_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -195,26 +195,19 @@ init_per_group_generic(Config0) ->

%% To reduce load when sending many messages
VirtHosts = virtual_hosts(),
ModulesToStop = [mod_offline, mod_blocking, mod_privacy, mod_roster, mod_last],
ModulesToStop = [mod_offline, mod_blocking, mod_privacy, mod_roster, mod_last,
mod_stream_management],

OldMods = save_modules(NodeName, VirtHosts),

rpc(NodeName, gen_mod_deps, start_modules,
[domain(), [{mod_global_distrib, Opts}]]),

[rpc(NodeName, gen_mod, stop_module, [VirtHost, Mod])
|| Mod <- ModulesToStop, VirtHost <- VirtHosts],

ResumeTimeout = rpc(NodeName, mod_stream_management, get_resume_timeout,
[domain(), 1]),
true = rpc(NodeName, mod_stream_management, set_resume_timeout,
[domain(), 1]),
rpc(NodeName, gen_mod_deps, start_modules,
[domain(), [{mod_global_distrib, Opts},
{mod_stream_management, [{resume_timeout, 1}]}]]),

OldMods ++
[
{{resume_timeout, NodeName}, ResumeTimeout} |
Config1
]
OldMods ++ Config1
end,
Config0,
get_hosts()),
Expand Down Expand Up @@ -244,10 +237,7 @@ end_per_group_generic(Config) ->
lists:foreach(
fun({NodeName, _, _}) ->
VirtHosts = virtual_hosts(),
[restore_modules(NodeName, VirtHost, Config) || VirtHost <- VirtHosts],

rpc(NodeName, mod_stream_management, set_resume_timeout,
[domain(), ?config({resume_timeout, NodeName}, Config)])
[restore_modules(NodeName, VirtHost, Config) || VirtHost <- VirtHosts]
end,
get_hosts()).

Expand Down
Loading