Skip to content

Commit

Permalink
Merge pull request #3909 from esl/c2s/enable_suites
Browse files Browse the repository at this point in the history
Enable global_distrib, muc, and fix stream_mgmt timeouts
  • Loading branch information
chrzaszcz authored Jan 9, 2023
2 parents 6823874 + 4351e4a commit fc5b4c2
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
14 changes: 6 additions & 8 deletions big_tests/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{suites, "tests", accounts_SUITE}.
{suites, "tests", adhoc_SUITE}.
{suites, "tests", amp_big_SUITE}.
% {suites, "tests", anonymous_SUITE}.
{suites, "tests", anonymous_SUITE}.
{suites, "tests", auth_methods_for_c2s_SUITE}.
{suites, "tests", bosh_SUITE}.
{suites, "tests", carboncopy_SUITE}.
Expand Down Expand Up @@ -66,15 +66,15 @@
{suites, "tests", mod_event_pusher_http_SUITE}.
{suites, "tests", mod_event_pusher_rabbit_SUITE}.
{suites, "tests", mod_event_pusher_sns_SUITE}.
% {suites, "tests", mod_global_distrib_SUITE}.
{suites, "tests", mod_global_distrib_SUITE}.
{suites, "tests", mod_http_upload_SUITE}.
{suites, "tests", mod_ping_SUITE}.
{suites, "tests", mod_time_SUITE}.
{suites, "tests", mod_version_SUITE}.
{suites, "tests", mongoose_cassandra_SUITE}.
{suites, "tests", mongoose_elasticsearch_SUITE}.
{suites, "tests", mongooseimctl_SUITE}.
% {suites, "tests", muc_SUITE}.
{suites, "tests", muc_SUITE}.
{suites, "tests", muc_http_api_SUITE}.
{suites, "tests", muc_light_SUITE}.
{suites, "tests", muc_light_http_api_SUITE}.
Expand All @@ -101,20 +101,18 @@
{suites, "tests", sasl_SUITE}.
{suites, "tests", sasl_external_SUITE}.
{suites, "tests", service_mongoose_system_metrics_SUITE}.
% {suites, "tests", shared_roster_SUITE}.
% {suites, "tests", sic_SUITE}.
{suites, "tests", shared_roster_SUITE}.
{suites, "tests", sic_SUITE}.
{suites, "tests", smart_markers_SUITE}.
{suites, "tests", sm_SUITE}.
{suites, "tests", vcard_SUITE}.
{suites, "tests", vcard_simple_SUITE}.
{suites, "tests", websockets_SUITE}.
{suites, "tests", xep_0352_csi_SUITE}.
{suites, "tests", service_domain_db_SUITE}.
{skip_cases, "tests", service_domain_db_SUITE,
[rest_delete_domain_cleans_data_from_mam], "this test tries to use presences"}.
{suites, "tests", domain_isolation_SUITE}.
{suites, "tests", domain_removal_SUITE}.
% {suites, "tests", dynamic_domains_SUITE}.
{suites, "tests", dynamic_domains_SUITE}.
{suites, "tests", local_iq_SUITE}.
% {suites, "tests", tcp_listener_SUITE}.

Expand Down
18 changes: 8 additions & 10 deletions big_tests/dynamic_domains.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

{suites, "tests", amp_big_SUITE}.

% {suites, "tests", anonymous_SUITE}.
{suites, "tests", anonymous_SUITE}.

{suites, "tests", auth_methods_for_c2s_SUITE}.

Expand All @@ -35,7 +35,7 @@

{suites, "tests", domain_isolation_SUITE}.

% {suites, "tests", dynamic_domains_SUITE}.
{suites, "tests", dynamic_domains_SUITE}.

{suites, "tests", extdisco_SUITE}.

Expand Down Expand Up @@ -100,11 +100,11 @@

{suites, "tests", mongooseimctl_SUITE}.

% {suites, "tests", muc_SUITE}.
% {skip_groups, "tests", muc_SUITE,
% [register_over_s2s],
% "at the moment S2S doesn't support dynamic domains "
% "(requires mod_register creating CT users)"}.
{suites, "tests", muc_SUITE}.
{skip_groups, "tests", muc_SUITE,
[register_over_s2s],
"at the moment S2S doesn't support dynamic domains "
"(requires mod_register creating CT users)"}.

{suites, "tests", muc_http_api_SUITE}.

Expand Down Expand Up @@ -140,15 +140,13 @@
{suites, "tests", sasl_external_SUITE}.

{suites, "tests", service_domain_db_SUITE}.
{skip_cases, "tests", service_domain_db_SUITE,
[rest_delete_domain_cleans_data_from_mam], "this test tries to use presences"}.

{suites, "tests", service_mongoose_system_metrics_SUITE}.
{skip_cases, "tests", service_mongoose_system_metrics_SUITE,
[xmpp_components_are_reported],
"at the moment external components doesn't support dynamic domains"}.

% {suites, "tests", sic_SUITE}.
{suites, "tests", sic_SUITE}.

{suites, "tests", smart_markers_SUITE}.
{suites, "tests", sm_SUITE}.
Expand Down
1 change: 1 addition & 0 deletions big_tests/tests/mim_c2s_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ init_per_suite(Config) ->
{start_ready_clients, fun ?MODULE:escalus_start/2}],
Config1 = save_c2s_listener(Config),
Config2 = dynamic_modules:save_modules(HostType, Config1),
dynamic_modules:ensure_stopped(HostType, [mod_presence]),
Config3 = escalus_users:update_userspec(Config2, alice, connection_steps, Steps),
Config4 = escalus_users:update_userspec(Config3, bob, connection_steps, Steps),
configure_c2s_listener(Config4, #{backwards_compatible_session => false, max_stanza_size => 1024}),
Expand Down
1 change: 0 additions & 1 deletion big_tests/tests/mod_global_distrib_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,6 @@ do_test_pm_with_ungraceful_reconnection_to_different_server(Config0, BeforeResum

%% Trigger rerouting
ok = rpc(asia_node, sys, resume, [C2sPid]),
C2sPid ! resume_timeout,

%% Let C2sPid to process the message and reroute (and die finally, poor little thing)
mongoose_helper:wait_for_pid_to_die(C2sPid),
Expand Down
4 changes: 3 additions & 1 deletion big_tests/tests/presence_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,9 @@ remove_roster(Config, UserSpec) ->
case lists:member(mod_roster, Mods) of
true ->
Acc = mongoose_helper:new_mongoose_acc(Server),
rpc(mim(), mod_roster, remove_user, [Acc, Username, Server]);
Extra = #{host_type => host_type()},
Params = #{jid => jid:make_bare(Username, Server)},
rpc(mim(), mod_roster, remove_user, [Acc, Params, Extra]);
false ->
case lists:member(mod_roster_rdbms, Mods) of
true ->
Expand Down
4 changes: 2 additions & 2 deletions rel/mim1.vars-toml.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@

[[host_config]]
host_type = \"anonymous\"
modules = { }
[host_config.modules.mod_presence]

[host_config.auth.anonymous]
allow_multiple_connections = true
protocol = \"both\"

[[host_config]]
host_type = \"dummy auth\"
modules = { }
[host_config.modules.mod_presence]

[host_config.auth.dummy]
base_time = 1
Expand Down
4 changes: 2 additions & 2 deletions rel/mim2.vars-toml.config
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
{host_config,
"[[host_config]]
host_type = \"dummy auth\"
modules = { }
auth.dummy = { }"}.
[host_config.modules.mod_presence]
[host_config.auth.dummy]"}.

%% Include common vars shared by all profiles
"./vars-toml.config".
4 changes: 3 additions & 1 deletion src/global_distrib/mod_global_distrib_receiver.erl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ start_listeners() ->
RetriesLeft :: non_neg_integer()) -> any().
start_listener({Addr, Port} = Ref, RetriesLeft) ->
?LOG_INFO(#{what => gd_start_listener, address => Addr, port => Port}),
case ranch:start_listener(Ref, ranch_tcp, #{num_acceptors => 10, ip => Addr, port => Port}, ?MODULE, []) of
SocketOpts = [{ip, Addr}, {port, Port}],
RanchOpts = #{max_connections => infinity, num_acceptors => 10, socket_opts => SocketOpts},
case ranch:start_listener(Ref, ranch_tcp, RanchOpts, ?MODULE, []) of
{ok, _} -> ok;
{error, eaddrinuse} when RetriesLeft > 0 ->
?LOG_ERROR(#{what => gd_start_listener_failed, address => Addr, port => Port,
Expand Down
4 changes: 2 additions & 2 deletions src/mod_presence.erl
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ presence_track(Acc, FromJid, ToJid, Packet, _, <<"unsubscribe">>) ->
presence_track(Acc, FromJid, ToJid, Packet, _, <<"unsubscribed">>) ->
process_presence_track_subscription_and_route(Acc, FromJid, ToJid, Packet, unsubscribed);
presence_track(Acc, FromJid, ToJid, Packet, _, <<"error">>) ->
ejabberd_router:route(ToJid, FromJid, Acc, Packet),
ejabberd_router:route(FromJid, ToJid, Acc, Packet),
Acc;
presence_track(Acc, FromJid, ToJid, Packet, _, <<"probe">>) ->
ejabberd_router:route(ToJid, FromJid, Acc, Packet),
ejabberd_router:route(FromJid, ToJid, Acc, Packet),
Acc.

process_presence_track_available(Acc, FromJid, ToJid, Packet, Presences) ->
Expand Down
8 changes: 4 additions & 4 deletions src/stream_management/mod_stream_management.erl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ handle_buffer_and_ack(Acc, C2SState, Jid, #sm_state{buffer = Buffer, buffer_max
NewBufferSize = BufferSize + 1,
MaybeActions = case is_buffer_full(NewBufferSize, BufferMax) of
true ->
{timeout, ?CONSTRAINT_CHECK_TIMEOUT, check_buffer_full};
{{timeout, ?MODULE}, ?CONSTRAINT_CHECK_TIMEOUT, check_buffer_full};
false ->
[]
end,
Expand Down Expand Up @@ -290,7 +290,7 @@ foreign_event(Acc, #{c2s_data := StateData,
error ->
{stop, mongoose_c2s_acc:to_acc(Acc, hard_stop, bad_stream_management_request)}
end;
foreign_event(Acc, #{c2s_data := StateData, event_type := timeout, event_content := check_buffer_full}, _Extra) ->
foreign_event(Acc, #{c2s_data := StateData, event_type := {timeout, ?MODULE}, event_content := check_buffer_full}, _Extra) ->
#sm_state{buffer_size = BufferSize, buffer_max = BufferMax} = get_mod_state(StateData),
case is_buffer_full(BufferSize, BufferMax) of
true ->
Expand All @@ -316,7 +316,7 @@ handle_user_stopping(Acc, #{c2s_data := StateData}, #{host_type := HostType}) ->
SmState ->
Timeout = get_resume_timeout(HostType),
NewSmState = notify_unacknowledged_messages(Acc, StateData, SmState),
Actions = [{push_callback_module, ?MODULE}, {timeout, Timeout, resume_timeout}, hibernate],
Actions = [{push_callback_module, ?MODULE}, {{timeout, ?MODULE}, Timeout, resume_timeout}, hibernate],
ToAcc = [{c2s_state, ?EXT_C2S_STATE(resume_session)}, {actions, Actions}, {state_mod, {?MODULE, NewSmState}}],
{stop, mongoose_c2s_acc:to_acc_many(Acc, ToAcc)}
end.
Expand Down Expand Up @@ -767,7 +767,7 @@ handle_event({call, From}, {stream_mgmt_resume, H}, ?EXT_C2S_STATE(resume_sessio
error ->
{stop, {shutdown, resumed}}
end;
handle_event(timeout, resume_timeout, ?EXT_C2S_STATE(resume_session), StateData) ->
handle_event({timeout, ?MODULE}, resume_timeout, ?EXT_C2S_STATE(resume_session), StateData) ->
{stop, {shutdown, ?MODULE}, StateData};
handle_event(EventType, EventContent, C2SState, StateData) ->
mongoose_c2s:handle_event(EventType, EventContent, C2SState, StateData).
Expand Down

0 comments on commit fc5b4c2

Please sign in to comment.