Skip to content

Feature/listeners - #4452

Merged
jacekwegr merged 184 commits into
masterfrom
feature/listeners
Apr 10, 2025
Merged

jacekwegr merged 184 commits into
masterfrom
feature/listeners

Conversation

@NelsonVides

@NelsonVides NelsonVides commented Jan 2, 2025 •

Copy link
Copy Markdown
Contributor

This PR contains all work from the feature branch feature/listeners:

  • Using ranch in s2s and component listeners.
  • Rework of s2s and component connections using gen_statem.
  • Support for TLS and dynamic domains in component connections.
  • Complete removal of fast_tls.
  • Unification and rework of connection-related instrumentation events.
  • Simplification of the just_tls module and other listener-related helpers.
  • Support for TLS 0-RTT and TLS 1.3 channel bindings in mod_fast_auth_token.
  • Usage of OS-provided CA when cacertfile is not provided.
  • Documentation updates.

This PR does not include:

  • Description of some of the new metrics for s2s and components. This needs to be done afterwards, but it was also missed before the changes.
  • Updating the migration guide.
  • Better code coverage of some modules. The stats are still better than before.

NelsonVides and others added 14 commits December 20, 2024 09:37
Note that components might register _any_ domain, even one not
necessarily provided by a static config or a dynamically configured one.
Hence it makes no sense to use the subdomains registration API as it was
described in a TODO in `mod_disco:get_external_components/2`.

Furthermore, when it comes to discovery, we want to leave all components
as discoverable, regardless of whether the component is a subdomain of a
static domain as it was previously done. The code filtering out
unrelated parent domains comes from long before MongooseIM 1.0.0, as
well as the option to set `extra_domains` to reenable visibility.
This option was used to make discoverable components that for a user
might not have been discoverable given the domain was unrelated. This
was so decided over a decade ago before MongooseIM 1.0.0, but I'd judge
a better solution is to leave components as either entirely discoverable
or entirely hidden by default, as components are usually dynamic and at
the same time fully controllable at the deployment, and we can now have
an infinite amount of domains for which a component can become a
subdomain and hard-coding "extra_domains" for each static or dynamic
domain is not feasible.
@mongoose-im

This comment was marked as outdated.

@codecov

codecov Bot commented Jan 2, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 83.62529% with 215 lines in your changes missing coverage. Please review.

Project coverage is 85.88%. Comparing base (5d1c011) to head (4d894fb).
Report is 185 commits behind head on master.

Files with missing lines Patch % Lines
src/s2s/mongoose_s2s_in.erl 73.88% 70 Missing ⚠️
src/s2s/mongoose_s2s_out.erl 77.72% 47 Missing ⚠️
src/component/mongoose_component_connection.erl 79.56% 38 Missing ⚠️
src/listeners/mongoose_xmpp_socket.erl 85.41% 14 Missing ⚠️
src/just_tls.erl 80.35% 11 Missing ⚠️
src/mongoose_addr_list.erl 91.13% 7 Missing ⚠️
src/c2s/mongoose_c2s.erl 91.07% 5 Missing ⚠️
src/mod_bosh_socket.erl 0.00% 3 Missing ⚠️
src/mod_websockets.erl 0.00% 3 Missing ⚠️
src/fast_auth_token/mod_fast_auth_token.erl 95.12% 2 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4452      +/-   ##
==========================================
+ Coverage   85.54%   85.88%   +0.34%     
==========================================
  Files         559      565       +6     
  Lines       34065    33803     -262     
==========================================
- Hits        29142    29033     -109     
+ Misses       4923     4770     -153     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

chrzaszcz and others added 9 commits April 4, 2025 20:16
- Don't mention just_tls, because this module doesn't need to be
  exposed to the user any longer (there is no 'module' option).
- Make it clear how to enable/disable TLS (like for the c2s listener).
- Specify the default mode as 'tls' for components.
- Components support dynamic domains now
- Correct typos and minor mistakes
MIM supports stream closing now
- Simplify type specs
- Set listener module to the correct value
  (actually, it would be used only for inspection)
@mongoose-im

mongoose-im commented Apr 7, 2025 •

Copy link
Copy Markdown
Collaborator

elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 631306b
Reports root/ big
OK: 683 / Failed: 0 / User-skipped: 72 / Auto-skipped: 0


small_tests_27 / small_tests / 631306b
Reports root / small


small_tests_26 / small_tests / 631306b
Reports root / small


small_tests_27_arm64 / small_tests / 631306b
Reports root / small


ldap_mnesia_27 / ldap_mnesia / 631306b
Reports root/ big
OK: 2331 / Failed: 0 / User-skipped: 1352 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 631306b
Reports root/ big
OK: 2331 / Failed: 0 / User-skipped: 1187 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 631306b
Reports root/ big
OK: 2465 / Failed: 0 / User-skipped: 1218 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 631306b
Reports root/ big
OK: 5160 / Failed: 0 / User-skipped: 154 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 631306b
Reports root/ big
OK: 5194 / Failed: 1 / User-skipped: 119 / Auto-skipped: 0

graphql_server_SUITE:admin_cli:clustering_tests:join_successful
{error,{#{what => invalid_response_code,expected_type => ok,
      response_code => {exit_status,1}},
    [{graphql_helper,assert_response_code,2,
             [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
              {line,258}]},
     {graphql_helper,get_ok_value,2,
             [{file,"/home/circleci/project/big_tests/tests/graphql_helper.erl"},
              {line,241}]},
     {graphql_server_SUITE,join_successful,1,
                 [{file,"/home/circleci/project/big_tests/tests/graphql_server_SUITE.erl"},
                {line,153}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1303}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1235}]}]}}

Report log


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 631306b
Reports root/ big
OK: 5030 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 631306b
Reports root/ big
OK: 5190 / Failed: 0 / User-skipped: 124 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 631306b
Reports root/ big
OK: 5280 / Failed: 0 / User-skipped: 188 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / 631306b
Reports root/ big
OK: 5562 / Failed: 0 / User-skipped: 149 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 631306b
Reports root/ big
OK: 5583 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 631306b
Reports root/ big
OK: 5418 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


mssql_mnesia_27 / odbc_mssql_mnesia / 631306b
Reports root/ big
OK: 5578 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0

Listeners: minor fixes in docs and refactoring
@mongoose-im

mongoose-im commented Apr 7, 2025 •

Copy link
Copy Markdown
Collaborator

dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 79e8f17
Reports root


elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 79e8f17
Reports root/ big
OK: 683 / Failed: 0 / User-skipped: 72 / Auto-skipped: 0


small_tests_26 / small_tests / 79e8f17
Reports root / small


small_tests_27 / small_tests / 79e8f17
Reports root / small


small_tests_27_arm64 / small_tests / 79e8f17
Reports root / small


ldap_mnesia_26 / ldap_mnesia / 79e8f17
Reports root/ big
OK: 2349 / Failed: 1 / User-skipped: 1187 / Auto-skipped: 0

jingle_SUITE:all:resp_4xx_from_sip_proxy_results_in_session_terminate
{error,
  {{assertion_failed,assert,is_iq_result,
     {xmlel,<<"iq">>,
       #{<<"from">> => <<"error.480@localhost">>,
         <<"id">> => <<"3fb7e029-046a-4c31-8cfb-a8ebf28c3a6d">>,
         <<"to">> =>
           <<"alice_resp_4xx_from_sip_proxy_results_in_session_terminate_1915@localhost/res1">>,
         <<"type">> => <<"set">>},
       [{xmlel,<<"jingle">>,
          #{<<"action">> => <<"session-terminate">>,
          <<"sid">> => <<"f5a6e922-84dc-4b5e-bf54-03b27a0e933a">>,
          <<"xmlns">> => <<"urn:xmpp:jingle:1">>},
          [{xmlel,<<"reason">>,#{},
             [{xmlel,<<"general-error">>,#{},[]},
            {xmlel,<<"sip-error">>,
              #{<<"code">> => <<"480">>},
              [{xmlcdata,<<"Temporarily Unavailable">>,
                 escaped}]}]}]}]},
     "<iq from='error.480@localhost' id='3fb7e029-046a-4c31-8cfb-a8ebf28c3a6d' to='alice_resp_4xx_from_sip_proxy_results_in_session_terminate_1915@localhost/res1' type='set'><jingle action='session-terminate' sid='f5a6e922-84dc-4b5e-bf54-03b27a0e933a' xmlns='urn:xmpp:jingle:1'><reason><general-error/><sip-error code='480'>Temporarily Unavailable</sip-error></reason></jingle></iq>"},
   [{escalus_new_assert,assert_true,2,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
       {line,88}]},
    {jingle_SUITE,send_initiate_and_wait_for_first_iq_set,2,
      [{file,"/home/circleci/project/big_tests/tests/jingle_SUITE.erl"},
       {line...

Report log


ldap_mnesia_27 / ldap_mnesia / 79e8f17
Reports root/ big
OK: 2331 / Failed: 0 / User-skipped: 1352 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 79e8f17
Reports root/ big
OK: 5160 / Failed: 0 / User-skipped: 154 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 79e8f17
Reports root/ big
OK: 5030 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 79e8f17
Reports root/ big
OK: 5195 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 79e8f17
Reports root/ big
OK: 2465 / Failed: 0 / User-skipped: 1218 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 79e8f17
Reports root/ big
OK: 5280 / Failed: 0 / User-skipped: 188 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / 79e8f17
Reports root/ big
OK: 5562 / Failed: 0 / User-skipped: 149 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 79e8f17
Reports root/ big
OK: 5418 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 79e8f17
Reports root/ big
OK: 5583 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


cockroachdb_cets_27 / cockroachdb_cets / 79e8f17
Reports root/ big
OK: 5299 / Failed: 6 / User-skipped: 189 / Auto-skipped: 0

pubsub_SUITE:dag+node_config:set_configuration_errors_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_set_configuration_errors_test_3812@localhost/res1">>,
          escalus_tcp,<0.117376.0>,
          [{event_manager,<0.117303.0>},
           {server,<<"localhost">>},
           {username,<<"alicE_set_configuration_errors_test_3812">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.117303.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_set_configuration_errors_test_3812">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,<<"alice_set_configuration_errors_test_3812">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,<<"alicE_set_configuration_errors_test_3812">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"d074c76cbb0702ed">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_check_response,4,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl...

Report log

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3862@localhost/res1">>,
          escalus_tcp,<0.118454.0>,
          [{event_manager,<0.118444.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3862">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.118444.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3862">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3862">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3862">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"22e2a4c8ed8be6d5">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3865@localhost/res1">>,
          escalus_tcp,<0.118532.0>,
          [{event_manager,<0.118521.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3865">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.118521.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3865">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3865">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3865">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"096673483636ef7b">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3867@localhost/res1">>,
          escalus_tcp,<0.118608.0>,
          [{event_manager,<0.118589.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3867">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.118589.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3867">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3867">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3867">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"76b863bf11c144aa">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3871@localhost/res1">>,
          escalus_tcp,<0.118685.0>,
          [{event_manager,<0.118675.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3871">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.118675.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3871">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3871">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3871">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"2c3b3395de29b91e">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3926@localhost/res1">>,
          escalus_tcp,<0.119970.0>,
          [{event_manager,<0.119959.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3926">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.119959.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3926">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3926">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3926">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"53a3a527d3830c55">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log


mssql_mnesia_27 / odbc_mssql_mnesia / 79e8f17
Reports root/ big
OK: 5578 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0

chrzaszcz and others added 9 commits April 8, 2025 12:24
config/2 works in a recursive way, and options are merged with defaults
The new function measure_element will be called for c2s, components
and s2s in/out.
Apply consistent rules to element-related events:
- Execute incoming events as soon as the data arrives
- Execute outgoing events just before sending XML
- Execute events only for XML elements.
  Stream start/end tags are skipped, because they are not
  complete XML elements.

Also: for simplicity, always include 'jid' in measurements -
      even if it is undefined.
Apply consistent rules to element-related events:
- Execute incoming events as soon as the data arrives
- Execute outgoing events just before sending XML
- Execute events only for XML elements.
  Stream start/end tags are skipped, because they are not
  complete XML elements.
Apply consistent rules to element-related events:
- Execute incoming events as soon as the data arrives
- Execute outgoing events just before sending XML
- Execute events only for XML elements.
  Stream start/end tags are skipped, because they are not
  complete XML elements.
Don't expect events for stream start/end tags.
Before, they were inconsistently reported.
Now they are always skipped.

Also: expect undefined jid in c2s events before auth,
because 'jid' is always included.
Tests need to be added separately, because we need to collect events
on the 'fed1' node.
- Check s2s_element_in and s2s_element_out with other element events.
  Also: check lserver where applicable.
- Check s2s_auth_failed in a new test case.
  Only the outgoing fail is checked, because the incoming one occurs
  on fed1, and we only test instrumentation events on mim1.
  We can amend this in the future, making it possible to check events
  on all nodes.
Listeners/improve instrumentation

This PR improves the consistency of reported instrumentation events for different types of connections:

    C2S - mongoose_c2s;
    Components - mongoose_component_connection;
    S2S - mongoose_s2s_in, mongoose_s2s_out.

The following rules are applied:

    Element events (i.e. xmpp_element_size_in/out and *_element_in/out) are always executed in pairs, e.g. xmpp_element_size_in with s2s_element_in.
        Before, they were triggered in multiple places, missing some of the events and causing inconsistency.
        The only exception is c2s before host_type is known, in which case c2s_element_in/out will be missing. We could introduce a host-type-less version of this event, but I didn't want to change too much in this PR.
    Incoming element events are executed as soon as the inbound element events are parsed.
    Outgoing element events are executed just before sending the outbound elements to the socket.
    Element events are only triggered for stream elements, and never for stream start/end tags.
        Before, they would be triggered for some start/end tags as well - but not always.
    *_auth_failed events are triggered on each SASL authentication failure.

Notes:

    Tests for S2S are improved to cover s2s_element_in/out and s2s_auth_failed.
    I left the metadata in the measurements as they were before, e.g. jid for c2s or pid and module for s2s. We could unify them as well, but I just wanted to limit the scope of the changes for now.

Left for the future:

    Test s2s_auth_failed event with direction => in on fed1 in s2s_SUITE. This would require extending instrument_helper to work for fed1.
    Improve metric documentation to include all events of s2s and components (now only c2s is fully covered).
@mongoose-im

mongoose-im commented Apr 9, 2025 •

Copy link
Copy Markdown
Collaborator

elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 757d023
Reports root/ big
OK: 683 / Failed: 0 / User-skipped: 72 / Auto-skipped: 0


small_tests_26 / small_tests / 757d023
Reports root / small


small_tests_27 / small_tests / 757d023
Reports root / small


small_tests_27_arm64 / small_tests / 757d023
Reports root / small


ldap_mnesia_27 / ldap_mnesia / 757d023
Reports root/ big
OK: 2332 / Failed: 0 / User-skipped: 1352 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 757d023
Reports root/ big
OK: 2332 / Failed: 0 / User-skipped: 1187 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 757d023
Reports root/ big
OK: 5160 / Failed: 0 / User-skipped: 154 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 757d023
Reports root/ big
OK: 2466 / Failed: 0 / User-skipped: 1218 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 757d023
Reports root/ big
OK: 5281 / Failed: 0 / User-skipped: 188 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 757d023
Reports root/ big
OK: 5195 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 757d023
Reports root/ big
OK: 5030 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 757d023
Reports root/ big
OK: 5188 / Failed: 1 / User-skipped: 124 / Auto-skipped: 1

last_SUITE:valid_queries:last_offline_user
{error,
  {{assertion_failed,assert,is_last_result,
     {xmlel,<<"presence">>,
       #{<<"from">> => <<"bob_unnamed_4475@domain.example.com/res1">>,
         <<"to">> => <<"alice_unnamed_4475@domain.example.com/res1">>,
         <<"type">> => <<"unavailable">>},
       [{xmlel,<<"status">>,#{},
          [{xmlcdata,<<"Shutdown by reason: stream_end">>,escaped}]}]},
     "<presence from='bob_unnamed_4475@domain.example.com/res1' to='alice_unnamed_4475@domain.example.com/res1' type='unavailable'><status>Shutdown by reason: stream_end</status></presence>"},
   [{escalus_new_assert,assert_true,2,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
       {line,88}]},
    {last_SUITE,'-last_offline_user/1-fun-0-',2,
      [{file,"/home/circleci/project/big_tests/tests/last_SUITE.erl"},
       {line,144}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,75}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1303}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1235}]}]}}

Report log


mysql_redis_27 / mysql_redis / 757d023
Reports root/ big
OK: 5563 / Failed: 0 / User-skipped: 149 / Auto-skipped: 0


cockroachdb_cets_27 / cockroachdb_cets / 757d023
Reports root/ big
OK: 5290 / Failed: 6 / User-skipped: 188 / Auto-skipped: 0

pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3789@localhost/res1">>,
          escalus_tcp,<0.118009.0>,
          [{event_manager,<0.117989.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3789">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.117989.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3789">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3789">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3789">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"55af9df45aad2c8b">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3845@localhost/res1">>,
          escalus_tcp,<0.119294.0>,
          [{event_manager,<0.119282.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3845">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.119282.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3845">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3845">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3845">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"c90fdb1186755c7e">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3848@localhost/res1">>,
          escalus_tcp,<0.119370.0>,
          [{event_manager,<0.119359.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3848">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.119359.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3848">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3848">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3848">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"2ac82643eae1734f">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3852@localhost/res1">>,
          escalus_tcp,<0.119448.0>,
          [{event_manager,<0.119445.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3852">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.119445.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3852">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3852">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3852">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"cb5d7f8292e40871">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3853@localhost/res1">>,
          escalus_tcp,<0.119523.0>,
          [{event_manager,<0.119503.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3853">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.119503.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3853">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3853">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3853">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"e3d20ed34f763d64">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log

pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_send_last_published_item_no_items_test_3858@localhost/res1">>,
          escalus_tcp,<0.119601.0>,
          [{event_manager,<0.119598.0>},
           {server,<<"localhost">>},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3858">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.119598.0>},
            {server,<<"localhost">>},
            {username,
              <<"alicE_send_last_published_item_no_items_test_3858">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_send_last_published_item_no_items_test_3858">>},
           {server,<<"localhost">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,fun escalus_auth:auth_plain/2},
           {wspath,undefined},
           {username,
             <<"alicE_send_last_published_item_no_items_test_3858">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"c67047accfe9e111">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {pubsub_tools,receive_response,3,
       [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
        {line,434}]},
     {pubsub_tools,receive_and_c...

Report log


pgsql_mnesia_26 / pgsql_mnesia / 757d023
Reports root/ big
OK: 5419 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 757d023
Reports root/ big
OK: 5584 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


mssql_mnesia_27 / odbc_mssql_mnesia / 757d023
Reports root/ big
OK: 5579 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0

@mongoose-im

mongoose-im commented Apr 10, 2025 •

Copy link
Copy Markdown
Collaborator

elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 4d894fb
Reports root/ big
OK: 683 / Failed: 0 / User-skipped: 72 / Auto-skipped: 0


small_tests_26 / small_tests / 4d894fb
Reports root / small


small_tests_27_arm64 / small_tests / 4d894fb
Reports root / small


ldap_mnesia_27 / ldap_mnesia / 4d894fb
Reports root/ big
OK: 2332 / Failed: 0 / User-skipped: 1352 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 4d894fb
Reports root/ big
OK: 2332 / Failed: 0 / User-skipped: 1187 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 4d894fb
Reports root/ big
OK: 2466 / Failed: 0 / User-skipped: 1218 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 4d894fb
Reports root/ big
OK: 5160 / Failed: 0 / User-skipped: 154 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 4d894fb
Reports root/ big
OK: 5030 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 4d894fb
Reports root/ big
OK: 5195 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 4d894fb
Reports root/ big
OK: 5281 / Failed: 0 / User-skipped: 188 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 4d894fb
Reports root/ big
OK: 5190 / Failed: 0 / User-skipped: 124 / Auto-skipped: 0


cockroachdb_cets_27 / cockroachdb_cets / 4d894fb
Reports root/ big
OK: 5281 / Failed: 0 / User-skipped: 188 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 4d894fb
Reports root/ big
OK: 5584 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 4d894fb
Reports root/ big
OK: 5419 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


mssql_mnesia_27 / odbc_mssql_mnesia / 4d894fb
Reports root/ big
OK: 5579 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0

@chrzaszcz
chrzaszcz marked this pull request as ready for review April 10, 2025 11:51

@jacekwegr jacekwegr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@jacekwegr
jacekwegr merged commit dae92ab into master Apr 10, 2025
@jacekwegr
jacekwegr deleted the feature/listeners branch April 10, 2025 12:21
@jacekwegr jacekwegr added this to the 6.4.0 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants