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

Enable domain_removal_SUITE for dynamic_domains.spec #3235

Merged
merged 2 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions big_tests/dynamic_domains.spec
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

{suites, "tests", vcard_SUITE}.
{suites, "tests", vcard_simple_SUITE}.
{suites, "tests", domain_removal_SUITE}.

{config, ["dynamic_domains.config", "test.config"]}.

Expand Down
34 changes: 18 additions & 16 deletions big_tests/tests/domain_removal_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
private_removal/1]).

-import(distributed_helper, [mim/0, rpc/4, subhost_pattern/1]).
-import(domain_helper, [host_type/0]).

-include("mam_helper.hrl").
-include_lib("escalus/include/escalus.hrl").
Expand Down Expand Up @@ -57,30 +58,31 @@ end_per_suite(Config) ->
%%% Group specific setup/teardown
%%%===================================================================
init_per_group(Group, Config) ->
case mongoose_helper:is_rdbms_enabled(domain()) of
case mongoose_helper:is_rdbms_enabled(host_type()) of
true ->
Config2 = dynamic_modules:save_modules(domain(), Config),
rpc(mim(), gen_mod_deps, start_modules, [domain(), group_to_modules(Group)]),
Config2 = dynamic_modules:save_modules(host_type(), Config),
rpc(mim(), gen_mod_deps, start_modules, [host_type(), group_to_modules(Group)]),
Config2;
false ->
{skip, require_rdbms}
end.

end_per_group(_Groupname, Config) ->
case mongoose_helper:is_rdbms_enabled(domain()) of
case mongoose_helper:is_rdbms_enabled(host_type()) of
true ->
dynamic_modules:restore_modules(domain(), Config);
dynamic_modules:restore_modules(host_type(), Config);
false ->
ok
end,
ok.

group_to_modules(mam_removal) ->
HostPattern = subhost_pattern(muc_light_helper:muc_host()),
[{mod_mam_meta, [{backend, rdbms}, {pm, []}, {muc, [{host, HostPattern}]}]},
{mod_muc_light, []}];
MucHost = subhost_pattern(muc_light_helper:muc_host_pattern()),
[{mod_mam_meta, [{backend, rdbms}, {pm, []}, {muc, [{host, MucHost}]}]},
{mod_muc_light, [{backend, rdbms}, {host, MucHost}]}];
group_to_modules(muc_light_removal) ->
[{mod_muc_light, [{backend, rdbms}]}];
MucHost = subhost_pattern(muc_light_helper:muc_host_pattern()),
[{mod_muc_light, [{backend, rdbms}, {host, MucHost}]}];
group_to_modules(inbox_removal) ->
[{mod_inbox, []}];
group_to_modules(private_removal) ->
Expand Down Expand Up @@ -143,22 +145,22 @@ muc_light_removal(Config0) ->
%% GIVEN a room
Room = muc_helper:fresh_room_name(),
MucHost = muc_light_helper:muc_host(),
RoomAddr = <<Room/binary, "@", MucHost/binary>>,
muc_light_helper:create_room(Room, MucHost, alice,
[], Config, muc_light_helper:ver(1)),
RoomAddr = <<Room/binary, "@", MucHost/binary>>,
escalus:send(Alice, escalus_stanza:groupchat_to(RoomAddr, <<"text">>)),
escalus:wait_for_stanza(Alice),
RoomID = select_room_id(domain(), Room, MucHost),
{selected, [_]} = select_affs_by_room_id(domain(), RoomID),
{selected, [_|_]} = select_config_by_room_id(domain(), RoomID),
RoomID = select_room_id(host_type(), Room, MucHost),
{selected, [_]} = select_affs_by_room_id(host_type(), RoomID),
{selected, [_|_]} = select_config_by_room_id(host_type(), RoomID),
{ok, _RoomConfig, _AffUsers, _Version} = get_room_info(Room, MucHost),
%% WHEN domain hook called
run_remove_domain(),
%% THEN Room info not available
{error, not_exists} = get_room_info(Room, MucHost),
%% THEN Tables are empty
{selected, []} = select_affs_by_room_id(domain(), RoomID),
{selected, []} = select_config_by_room_id(domain(), RoomID)
{selected, []} = select_affs_by_room_id(host_type(), RoomID),
{selected, []} = select_config_by_room_id(host_type(), RoomID)
end,
escalus_fresh:story_with_config(Config0, [{alice, 1}], F).

Expand Down Expand Up @@ -198,7 +200,7 @@ private_removal(Config) ->
end).

run_remove_domain() ->
rpc(mim(), mongoose_hooks, remove_domain, [domain(), domain()]).
rpc(mim(), mongoose_hooks, remove_domain, [host_type(), domain()]).

get_room_info(RoomU, RoomS) ->
rpc(mim(), mod_muc_light_db_backend, get_info, [{RoomU, RoomS}]).
Expand Down