From 10bdddac79d802f9d91b4178b036a2b59707ef2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Mon, 6 Sep 2021 12:22:38 +0200 Subject: [PATCH 1/6] Remove TODO which is now done --- src/mod_commands.erl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mod_commands.erl b/src/mod_commands.erl index e7adcb4a69..0402cf646e 100644 --- a/src/mod_commands.erl +++ b/src/mod_commands.erl @@ -52,9 +52,6 @@ stop(_) -> stop(). -spec supported_features() -> [atom()]. supported_features() -> - %% TODO: this module should be reworked into service - %% from the quick look it seems that the conversion for dynamic domains is done, - %% but there's no testing for this module enabled at dynamic_domains.spec yet. [dynamic_domains]. %%% From 3135513eb8d1827516fd9bba42681653b4e7d637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Tue, 7 Sep 2021 08:55:22 +0200 Subject: [PATCH 2/6] Stop repeating muc_light_http_api tests --- big_tests/tests/muc_light_http_api_SUITE.erl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/big_tests/tests/muc_light_http_api_SUITE.erl b/big_tests/tests/muc_light_http_api_SUITE.erl index 775fb21eb3..25be5c6eda 100644 --- a/big_tests/tests/muc_light_http_api_SUITE.erl +++ b/big_tests/tests/muc_light_http_api_SUITE.erl @@ -38,9 +38,8 @@ all() -> {group, negative}]. groups() -> - G = [{positive, [parallel], success_response()}, - {negative, [parallel], negative_response()}], - ct_helper:repeat_all_until_all_ok(G). + [{positive, [parallel], success_response()}, + {negative, [parallel], negative_response()}]. success_response() -> [create_unique_room, From dd823b03e92a033980deaa0e8b1145c8fdc59b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Tue, 7 Sep 2021 08:56:08 +0200 Subject: [PATCH 3/6] Enable mod_muc_light_commands for dynamic domains --- rel/mim1.vars-toml.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rel/mim1.vars-toml.config b/rel/mim1.vars-toml.config index fba7c76843..1310cd335a 100644 --- a/rel/mim1.vars-toml.config +++ b/rel/mim1.vars-toml.config @@ -29,6 +29,8 @@ [host_config.modules.mod_commands] + [host_config.modules.mod_muc_light_commands] + [host_config.modules.mod_stream_management] [host_config.modules.mod_disco] From 2cd9d3fec16e86780414b7ba20b8249ee807f484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Tue, 7 Sep 2021 08:56:54 +0200 Subject: [PATCH 4/6] Adapt muc_light_http_api tests for dynamic domains --- big_tests/tests/muc_light_http_api_SUITE.erl | 39 ++++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/big_tests/tests/muc_light_http_api_SUITE.erl b/big_tests/tests/muc_light_http_api_SUITE.erl index 25be5c6eda..832121a34c 100644 --- a/big_tests/tests/muc_light_http_api_SUITE.erl +++ b/big_tests/tests/muc_light_http_api_SUITE.erl @@ -28,6 +28,7 @@ -import(muc_light_helper, [stanza_create_room/3]). -import(distributed_helper, [subhost_pattern/1]). +-import(domain_helper, [host_type/0]). %%-------------------------------------------------------------------- %% Suite configuration @@ -61,15 +62,15 @@ negative_response() -> %%-------------------------------------------------------------------- init_per_suite(Config) -> - dynamic_modules:start(<<"localhost">>, mod_muc_light, - [{host, subhost_pattern(muc_light_domain())}, + dynamic_modules:start(host_type(), mod_muc_light, + [{host, subhost_pattern(muc_light_helper:muc_host_pattern())}, {rooms_in_rosters, true}, {backend, mongoose_helper:mnesia_or_rdbms_backend()}]), escalus:init_per_suite(Config). end_per_suite(Config) -> escalus_fresh:clean(), - dynamic_modules:stop(<<"localhost">>, mod_muc_light), + dynamic_modules:stop(host_type(), mod_muc_light), escalus:end_per_suite(Config). init_per_group(_GroupName, Config) -> @@ -91,8 +92,7 @@ end_per_testcase(CaseName, Config) -> create_unique_room(Config) -> escalus:fresh_story(Config, [{alice, 1}], fun(Alice) -> - Domain = <<"localhost">>, - Path = <<"/muc-lights", $/, Domain/binary>>, + Path = path([domain()]), Name = <<"wonderland">>, Body = #{ name => Name, owner => escalus_client:short_jid(Alice), @@ -107,8 +107,7 @@ create_unique_room(Config) -> create_identifiable_room(Config) -> escalus:fresh_story(Config, [{alice, 1}], fun(Alice) -> - Domain = <<"localhost">>, - Path = <<"/muc-lights", $/, Domain/binary>>, + Path = path([domain()]), RandBits = base16:encode(crypto:strong_rand_bytes(5)), Name = <<"wonderland">>, RoomID = <<"just_some_id_", RandBits/binary>>, @@ -128,10 +127,8 @@ create_identifiable_room(Config) -> end). invite_to_room(Config) -> - Domain = muc_light_domain(), Name = <<"wonderland">>, - Path = <<"/muc-lights", $/, Domain/binary, $/, Name/binary, $/, - "participants">>, + Path = path([muc_light_domain(), Name, "participants"]), escalus:fresh_story(Config, [{alice, 1}, {bob, 1}, {kate, 1}], fun(Alice, Bob, Kate) -> %% XMPP: Alice creates a room. @@ -157,10 +154,8 @@ invite_to_room(Config) -> end). send_message_to_room(Config) -> - Domain = muc_light_domain(), Name = <<"wonderland">>, - Path = <<"/muc-lights",$/,Domain/binary,$/, - Name/binary,$/,"messages">>, + Path = path([muc_light_domain(), Name, "messages"]), Text = <<"Hello everyone!">>, escalus:fresh_story(Config, [{alice, 1}, {bob, 1}, {kate, 1}], @@ -228,8 +223,7 @@ delete_room_without_having_a_membership(Config) -> create_non_unique_room(Config) -> escalus:fresh_story(Config, [{alice, 1}], fun(Alice) -> - Domain = <<"localhost">>, - Path = <<"/muc-lights", $/, Domain/binary>>, + Path = path([domain()]), RandBits = base16:encode(crypto:strong_rand_bytes(5)), Name = <<"wonderland">>, RoomID = <<"just_some_id_", RandBits/binary>>, @@ -297,15 +291,20 @@ check_delete_room(Config, RoomNameToCreate, RoomNameToDelete, RoomOwner, escalus:assert(is_iq_result, CreationResult), muc_light_helper:verify_aff_bcast(Members, Affiliations), ShortJID = escalus_client:short_jid(UserToExecuteDelete), - Path = <<"/muc-lights",$/,Domain/binary,$/, - RoomNameToDelete/binary,$/,ShortJID/binary,$/,"management">>, + Path = path([muc_light_domain(), RoomNameToDelete, ShortJID, "management"]), rest_helper:delete(admin, Path). + %%-------------------------------------------------------------------- -%% Constants +%% Helpers %%-------------------------------------------------------------------- +path(Items) -> + AllItems = ["muc-lights" | Items], + iolist_to_binary([[$/, Item] || Item <- AllItems]). + muc_light_domain() -> - XMPPParentDomain = ct:get_config({hosts, mim, domain}), - <<"muclight", ".", XMPPParentDomain/binary>>. + muc_light_helper:muc_host(). +domain() -> + ct:get_config({hosts, mim, domain}). From 2d070be75939518f17ee1e796dde7b9ba1ffb5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Tue, 7 Sep 2021 08:59:16 +0200 Subject: [PATCH 5/6] Enable muc_light_http_api tests for dynamic domains --- big_tests/dynamic_domains.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/big_tests/dynamic_domains.spec b/big_tests/dynamic_domains.spec index b6fd565063..e0916a26db 100644 --- a/big_tests/dynamic_domains.spec +++ b/big_tests/dynamic_domains.spec @@ -39,6 +39,8 @@ {suites, "tests", muc_light_legacy_SUITE}. +{suites, "tests", muc_light_http_api_SUITE}. + {suites, "tests", offline_SUITE}. {suites, "tests", offline_stub_SUITE}. From 14c71b8487d3cb98d4905a0591d939212ba4a23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Tue, 7 Sep 2021 09:00:05 +0200 Subject: [PATCH 6/6] Remove TODO which is now done --- src/muc_light/mod_muc_light_commands.erl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/muc_light/mod_muc_light_commands.erl b/src/muc_light/mod_muc_light_commands.erl index c9b4323723..92f321c836 100644 --- a/src/muc_light/mod_muc_light_commands.erl +++ b/src/muc_light/mod_muc_light_commands.erl @@ -51,9 +51,6 @@ stop(_) -> -spec supported_features() -> [atom()]. supported_features() -> - %% TODO: this module should be reworked into service - %% from the quick look it seems that the conversion for dynamic domains is done, - %% but there's no testing for this module enabled at dynamic_domains.spec yet. [dynamic_domains]. %%--------------------------------------------------------------------