@@ -69,7 +69,8 @@ muc_test_cases() ->
6969 user_cant_be_invited_given_room_jid_in_a_non_muc_light_domain ,
7070 user_cant_be_removed_given_room_jid_in_a_non_muc_light_domain ,
7171 message_cant_be_sent_given_room_jid_in_a_non_muc_light_domain ,
72- messages_cant_be_read_given_room_jid_in_a_non_muc_light_domain
72+ messages_cant_be_read_given_room_jid_in_a_non_muc_light_domain ,
73+ room_can_be_created_in_a_secondary_muc_light_domain
7374 ].
7475
7576roster_test_cases () ->
@@ -88,18 +89,29 @@ init_per_suite(C) ->
8889 dynamic_modules :start (Host , mod_muc_light ,
8990 [{host , binary_to_list (MUCLightHost )},
9091 {rooms_in_rosters , true }]),
91- NonMUCLightHost = <<" nonmuclight." , Host /binary >>, % register!
92+ SecondaryMUCLightHost = <<" othermuclight." , Host /binary >>,
93+ register_secondary_muc_light_service (SecondaryMUCLightHost ),
94+ NonMUCLightHost = <<" notamuclight." , Host /binary >>, % register!
9295 [{muc_light_host , MUCLightHost },
96+ {secondary_muc_light_host , SecondaryMUCLightHost },
9397 {non_muc_light_host , NonMUCLightHost } | escalus :init_per_suite (C1 )].
9498
9599end_per_suite (Config ) ->
96100 escalus_fresh :clean (),
97101 Host = ct :get_config ({hosts , mim , domain }),
98102 rest_helper :maybe_disable_mam (mam_helper :backend (), Host ),
99103 dynamic_modules :stop (Host , mod_muc_light ),
104+ unregister_secondary_muc_light_service (? config (secondary_muc_light_host , Config )),
100105 application :stop (shotgun ),
101106 escalus :end_per_suite (Config ).
102107
108+ register_secondary_muc_light_service (MUCLightHost ) ->
109+ PacketHandler = escalus_ejabberd :rpc (mongoose_packet_handler , new , [mod_muc_light ]),
110+ escalus_ejabberd :rpc (ejabberd_router , register_route , [MUCLightHost , PacketHandler ]).
111+
112+ unregister_secondary_muc_light_service (MUCLightHost ) ->
113+ escalus_ejabberd :rpc (ejabberd_router , unregister_route , [MUCLightHost ]).
114+
103115init_per_group (_GN , C ) ->
104116 C .
105117
@@ -451,6 +463,19 @@ messages_cant_be_read_given_room_jid_in_a_non_muc_light_domain(Config) ->
451463 ? assertEqual (<<" 400" >>, Status )
452464 end ).
453465
466+ room_can_be_created_in_a_secondary_muc_light_domain (Config ) ->
467+ escalus :fresh_story (Config , [{alice , 1 }], fun (Alice ) ->
468+ RoomID = <<" some_id_but_different_domain" >>,
469+ RoomJID = <<RoomID /binary , " @" , (? config (secondary_muc_light_host , Config ))/binary >>,
470+ Creds = credentials ({alice , Alice }),
471+
472+ {{Status , _ }, _ } = create_room_with_id_request (Creds ,
473+ <<" some_name" >>,
474+ <<" some subject" >>,
475+ RoomJID ),
476+ ? assertEqual (<<" 201" >>, Status )
477+ end ).
478+
454479assert_room_messages (RecvMsg , {_ID , _GenFrom , GenMsg }) ->
455480 escalus :assert (is_chat_message , [maps :get (body , RecvMsg )], GenMsg ),
456481 ok .
0 commit comments