Skip to content

Commit

Permalink
Add owner handover test and simplify tests
Browse files Browse the repository at this point in the history
As per code review comments, simplify multiple_owner_change case, and remove
the allow_multiple_owners option from config_parser_helper.
  • Loading branch information
gustawlippa committed Nov 12, 2024
1 parent 23f84ca commit abf6245
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
25 changes: 15 additions & 10 deletions big_tests/tests/muc_light_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
remove_and_add_users/1,
multiple_owner_change/1,
explicit_owner_change/1,
explicit_owner_handover/1,
implicit_owner_change/1,
edge_case_owner_change/1,
adding_wrongly_named_user_triggers_infinite_loop/1
Expand Down Expand Up @@ -180,6 +181,7 @@ groups() ->
assorted_config_doesnt_lead_to_duplication,
remove_and_add_users,
explicit_owner_change,
explicit_owner_handover,
multiple_owner_change,
implicit_owner_change,
edge_case_owner_change,
Expand Down Expand Up @@ -798,17 +800,10 @@ remove_and_add_users(Config) ->

multiple_owner_change(Config) ->
escalus:story(Config, [{alice, 1}, {bob, 1}, {kate, 1}], fun(Alice, Bob, Kate) ->
TS = instrument_helper:timestamp(),
AffUsersChanges1 = [{Bob, none}, {Kate, none}],
escalus:send(Alice, stanza_aff_set(?ROOM, AffUsersChanges1)),
verify_aff_bcast([{Alice, owner}], AffUsersChanges1),
escalus:assert(is_iq_result, escalus:wait_for_stanza(Alice)),
AffUsersChanges2 = [{Bob, owner}, {Kate, owner}],
AffUsersChanges2 = [{Bob, owner}],
escalus:send(Alice, stanza_aff_set(?ROOM, AffUsersChanges2)),
verify_aff_bcast([{Alice, owner}, {Bob, owner}, {Kate, owner}], AffUsersChanges2),
escalus:assert(is_iq_result, escalus:wait_for_stanza(Alice)),
assert_cache_miss_event(TS, 1, room_bin_jid(?ROOM)),
assert_cache_hit_event(TS, 1, room_bin_jid(?ROOM))
verify_aff_bcast([{Alice, owner}, {Bob, owner}, {Kate, member}], AffUsersChanges2),
escalus:assert(is_iq_result, escalus:wait_for_stanza(Alice))
end).

explicit_owner_change(Config) ->
Expand All @@ -819,6 +814,16 @@ explicit_owner_change(Config) ->
escalus:assert(is_iq_result, escalus:wait_for_stanza(Alice))
end).

explicit_owner_handover(Config) ->
% check that Alice looses ownership when Kate is set to owner
escalus:story(Config, [{alice, 1}, {bob, 1}, {kate, 1}], fun(Alice, Bob, Kate) ->
ReqAffUsersChanges = [{Kate, owner}],
escalus:send(Alice, stanza_aff_set(?ROOM, ReqAffUsersChanges)),
ExpectedAffUserChanges = [{Alice, member} | ReqAffUsersChanges],
verify_aff_bcast([{Kate, owner}, {Alice, member}, {Bob, member}], ExpectedAffUserChanges),
escalus:assert(is_iq_result, escalus:wait_for_stanza(Alice))
end).

implicit_owner_change(Config) ->
escalus:story(Config, [{alice, 1}, {bob, 1}, {kate, 1}], fun(Alice, Bob, Kate) ->
AffUsersChanges1 = [{Bob, none}, {Alice, member}],
Expand Down
1 change: 0 additions & 1 deletion test/common/config_parser_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ all_modules() ->
max_occupants => 50,
rooms_in_rosters => true,
rooms_per_page => 5,
allow_multiple_owners => false,
rooms_per_user => 10}),
mod_push_service_mongoosepush =>
#{api_version => <<"v3">>,
Expand Down

0 comments on commit abf6245

Please sign in to comment.