Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ets:match_object/2 instead of ets:select/2 #4075

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

arcusfelis
Copy link
Contributor

This PR addresses "Just a bit easier code, no need for guards or the return pattern".

Proposed changes include:

  • Use ets:match_object/2 instead of ets:select/2

Does the same, just a bit easier to read
@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 2, 2023

small_tests_24 / small_tests / 83f0713
Reports root / small


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 83f0713
Reports root/ big
OK: 369 / Failed: 0 / User-skipped: 38 / Auto-skipped: 0


small_tests_25_arm64 / small_tests / 83f0713
Reports root / small


small_tests_25 / small_tests / 83f0713
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 83f0713
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 83f0713
Reports root/ big
OK: 4220 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 83f0713
Reports root/ big
OK: 4194 / Failed: 0 / User-skipped: 110 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 83f0713
Reports root/ big
OK: 4220 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 83f0713
Reports root/ big
OK: 4211 / Failed: 6 / User-skipped: 87 / Auto-skipped: 0

mod_blocking_SUITE:manage:add_another_user_to_blocklist
{error,{{assertion_failed,assert_many,false,
              [is_iq_result,#Fun<mod_blocking_SUITE.32.127406420>],
              [],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {mod_blocking_SUITE,'-add_another_user_to_blocklist/1-fun-0-',2,
               [{file,"/home/circleci/project/big_tests/tests/mod_blocking_SUITE.erl"},
                {line,179}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

mod_blocking_SUITE:manage:clear_blocklist
{error,{{assertion_failed,assert_many,false,
              [is_iq_result,#Fun<mod_blocking_SUITE.32.127406420>],
              [],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {mod_blocking_SUITE,'-clear_blocklist/1-fun-0-',3,
               [{file,"/home/circleci/project/big_tests/tests/mod_blocking_SUITE.erl"},
                {line,220}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

mod_blocking_SUITE:manage:remove_many_user_from_blocklist
{error,{{assertion_failed,assert_many,false,
              [is_iq_result,#Fun<mod_blocking_SUITE.32.127406420>],
              [],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {mod_blocking_SUITE,'-remove_many_user_from_blocklist/1-fun-0-',3,
               [{file,"/home/circleci/project/big_tests/tests/mod_blocking_SUITE.erl"},
                {line,209}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

mod_blocking_SUITE:manage:remove_user_from_blocklist
{error,{{assertion_failed,assert_many,false,
              [is_iq_result,#Fun<mod_blocking_SUITE.36.127406420>],
              [],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {mod_blocking_SUITE,'-remove_user_from_blocklist/1-fun-0-',2,
               [{file,"/home/circleci/project/big_tests/tests/mod_blocking_SUITE.erl"},
                {line,200}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

mod_blocking_SUITE:manage:add_many_users_to_blocklist
{error,{{assertion_failed,assert_many,false,
              [is_iq_result,#Fun<mod_blocking_SUITE.32.127406420>],
              [],[]},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {mod_blocking_SUITE,'-add_many_users_to_blocklist/1-fun-0-',4,
               [{file,"/home/circleci/project/big_tests/tests/mod_blocking_SUITE.erl"},
                {line,188}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1291}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1223}]}]}}

Report log

mod_blocking_SUITE:manage:add_user_to_blocklist
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alice_unnamed_2338_add_user_to_blocklist_2342@domain.example.com/res1">>,
          escalus_tcp,<0.27406.1>,
          [{event_manager,<0.27372.1>},
           {server,<<"domain.example.com">>},
           {username,
             <<"alicE_unnamed_2338_add_user_to_blocklist_2342">>},
           {resource,<<"res1">>}],
          [{event_client,
             [{event_manager,<0.27372.1>},
            {server,<<"domain.example.com">>},
            {username,
              <<"alicE_unnamed_2338_add_user_to_blocklist_2342">>},
            {resource,<<"res1">>}]},
           {resource,<<"res1">>},
           {username,
             <<"alice_unnamed_2338_add_user_to_blocklist_2342">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {port,5222},
           {auth,{escalus_auth,auth_plain}},
           {wspath,undefined},
           {username,
             <<"alicE_unnamed_2338_add_user_to_blocklist_2342">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"a72e6e2d6be8091d">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {mod_blocking_SUITE,'-add_user_to_blocklist/1-fun-0-',2,
       [{file,
          "/home/circleci/project/big...

Report log


ldap_mnesia_25 / ldap_mnesia / 83f0713
Reports root/ big
OK: 2257 / Failed: 1 / User-skipped: 830 / Auto-skipped: 0

mod_global_distrib_SUITE:hosts_refresher:test_host_refreshing
{error,
  {{trees_for_connections_present,true,[{times,50,false}],ok},
   [{mongoose_helper,do_wait_until,2,
      [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
       {line,357}]},
    {mod_global_distrib_SUITE,test_host_refreshing,1,
      [{file,
         "/home/circleci/project/big_tests/tests/mod_global_distrib_SUITE.erl"},
       {line,384}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


pgsql_mnesia_24 / pgsql_mnesia / 83f0713
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 83f0713
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 83f0713
Reports root/ big
OK: 2404 / Failed: 0 / User-skipped: 684 / Auto-skipped: 0


pgsql_cets_25 / pgsql_cets / 83f0713
Reports root/ big
OK: 4580 / Failed: 1 / User-skipped: 115 / Auto-skipped: 0

mod_global_distrib_SUITE:hosts_refresher:test_host_refreshing
{error,
  {{trees_for_connections_present,true,[{times,50,false}],ok},
   [{mongoose_helper,do_wait_until,2,
      [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
       {line,357}]},
    {mod_global_distrib_SUITE,test_host_refreshing,1,
      [{file,
         "/home/circleci/project/big_tests/tests/mod_global_distrib_SUITE.erl"},
       {line,384}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


mysql_redis_25 / mysql_redis / 83f0713
Reports root/ big
OK: 4591 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 83f0713
Reports root/ big
OK: 4602 / Failed: 0 / User-skipped: 94 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 83f0713
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 83f0713
Reports root/ big
OK: 4217 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


pgsql_cets_25 / pgsql_cets / 83f0713
Reports root/ big
OK: 4581 / Failed: 0 / User-skipped: 115 / Auto-skipped: 0

@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03% 🎉

Comparison is base (5f98eeb) 83.95% compared to head (83f0713) 83.99%.

Additional details and impacted files
@@               Coverage Diff                @@
##           feature/cets    #4075      +/-   ##
================================================
+ Coverage         83.95%   83.99%   +0.03%     
================================================
  Files               543      543              
  Lines             33454    33454              
================================================
+ Hits              28087    28099      +12     
+ Misses             5367     5355      -12     
Files Changed Coverage Δ
src/ejabberd_sm_cets.erl 100.00% <100.00%> (ø)

... and 11 files with indirect coverage changes

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

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

👌

@chrzaszcz chrzaszcz merged commit 167297d into feature/cets Aug 2, 2023
4 checks passed
@chrzaszcz chrzaszcz deleted the use-match-instead-of-select branch August 2, 2023 08:56
@chrzaszcz chrzaszcz added this to the 6.2.0 milestone Dec 11, 2023
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.

4 participants