From d457f814ca0954b65df5cff02e8afa56a3d1aa43 Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Thu, 26 Aug 2021 16:27:45 +0200 Subject: [PATCH 1/2] Enable domain_removal_SUITE for dynamic_domains.spec --- big_tests/dynamic_domains.spec | 1 + big_tests/tests/domain_removal_SUITE.erl | 36 +++++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/big_tests/dynamic_domains.spec b/big_tests/dynamic_domains.spec index 609d2786756..8fbd4a74afa 100644 --- a/big_tests/dynamic_domains.spec +++ b/big_tests/dynamic_domains.spec @@ -62,6 +62,7 @@ {suites, "tests", vcard_SUITE}. {suites, "tests", vcard_simple_SUITE}. +{suites, "tests", domain_removal_SUITE}. {config, ["dynamic_domains.config", "test.config"]}. diff --git a/big_tests/tests/domain_removal_SUITE.erl b/big_tests/tests/domain_removal_SUITE.erl index a465fc3a7bb..8f98dc78d54 100644 --- a/big_tests/tests/domain_removal_SUITE.erl +++ b/big_tests/tests/domain_removal_SUITE.erl @@ -44,6 +44,9 @@ groups() -> domain() -> ct:get_config({hosts, mim, domain}). +host_type() -> + ct:get_config({hosts, mim, host_type}). + %%%=================================================================== %%% Overall setup/teardown %%%=================================================================== @@ -57,30 +60,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) -> @@ -143,22 +147,22 @@ muc_light_removal(Config0) -> %% GIVEN a room Room = muc_helper:fresh_room_name(), MucHost = muc_light_helper:muc_host(), + RoomAddr = <>, muc_light_helper:create_room(Room, MucHost, alice, [], Config, muc_light_helper:ver(1)), - RoomAddr = <>, 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). @@ -198,7 +202,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}]). From d13628235185ffb16129efb782aa1159f7dba78c Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Fri, 27 Aug 2021 16:18:51 +0200 Subject: [PATCH 2/2] Import host_type into domain_removal_SUITE --- big_tests/tests/domain_removal_SUITE.erl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/big_tests/tests/domain_removal_SUITE.erl b/big_tests/tests/domain_removal_SUITE.erl index 8f98dc78d54..47cd4d6f261 100644 --- a/big_tests/tests/domain_removal_SUITE.erl +++ b/big_tests/tests/domain_removal_SUITE.erl @@ -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"). @@ -44,9 +45,6 @@ groups() -> domain() -> ct:get_config({hosts, mim, domain}). -host_type() -> - ct:get_config({hosts, mim, host_type}). - %%%=================================================================== %%% Overall setup/teardown %%%===================================================================