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

Domain service test fix #4362

Merged
merged 8 commits into from
Aug 22, 2024
Merged

Domain service test fix #4362

merged 8 commits into from
Aug 22, 2024

Conversation

arcusfelis
Copy link
Contributor

@arcusfelis arcusfelis commented Aug 20, 2024

This PR addresses "MIM-2272 Fix flaky "service_domain_db" tests"

Example of the broken test timeout https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4357/235426/odbc_mssql_mnesia.27.0.1-amd64/big/ct_run.test%404f8408ead5c6.2024-08-14_09.06.15/big_tests.tests.service_domain_db_SUITE.logs/run.2024-08-14_09.27.28/service_domain_db_suite.rest_delete_domain_cleans_data_from_mam.283010.html

Proposed changes include:

  • Higher timeouts when pinging domain service gen_server. It affects only the test code. 15 seconds for ping timeout, 30 seconds for the RPC timeout, so we can see what the server is doing, when the ping times out.
  • Add debug logging for SQL queries which are done by the domain service.
  • Do some stuff in parallel.
  • There was slow code in fixing gaps because duplicate key error was causing the insert_dummy_event transaction to get restarted (i.e. 3100 milliseconds for a gap). Sometimes test could create 20 gaps, so 20300 = 6 seconds, and our timeout is default 5 seconds. So, we added catch there.
  • Add debug_ dictionary entries. Useful to figure out what the server is doing from the outside.
  • Added info how to debug it.
  • Repeated 30 times - no errors locally or on CI.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 20, 2024

ldap_mnesia_26 / ldap_mnesia / b94a8cf
Reports root/ big
OK: 211 / Failed: 0 / User-skipped: 125 / Auto-skipped: 0


ldap_mnesia_27 / ldap_mnesia / b94a8cf
Reports root/ big
OK: 211 / Failed: 0 / User-skipped: 125 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / b94a8cf
Reports root/ big
OK: 211 / Failed: 0 / User-skipped: 125 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / b94a8cf
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / b94a8cf
Reports root/ big
OK: 439 / Failed: 0 / User-skipped: 47 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / b94a8cf
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / b94a8cf
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / b94a8cf
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / b94a8cf
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / b94a8cf
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / b94a8cf
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


small_tests_26 / small_tests / b94a8cf
Reports root / small


small_tests_27 / small_tests / b94a8cf
Reports root / small


mssql_mnesia_27 / odbc_mssql_mnesia / b94a8cf
Reports root/ big
OK: 3375 / Failed: 6 / User-skipped: 0 / Auto-skipped: 0

service_domain_db_SUITE:db:rest_with_auth:rest_with_auth_parallel:rest_delete_domain_cleans_data_from_mam
{error,
  {{badrpc,timeout},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},service_domain_db,sync_local,[]],
      [{file,
         "/home/circleci/project/big_tests/../test/common/distributed_helper.erl"},
       {line,140}]},
    {service_domain_db_SUITE,sync_local,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1214}]},
    {service_domain_db_SUITE,sync,0,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1193}]},
    {service_domain_db_SUITE,
      '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,965}]},
    {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,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

service_domain_db_SUITE:db:rest_with_auth:rest_with_auth_parallel:rest_delete_domain_cleans_data_from_mam
{error,
  {{badrpc,timeout},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},service_domain_db,sync_local,[]],
      [{file,
         "/home/circleci/project/big_tests/../test/common/distributed_helper.erl"},
       {line,140}]},
    {service_domain_db_SUITE,sync_local,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1214}]},
    {service_domain_db_SUITE,sync,0,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1193}]},
    {service_domain_db_SUITE,
      '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,965}]},
    {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,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

service_domain_db_SUITE:db:rest_without_auth:rest_without_auth_parallel:rest_delete_domain_cleans_data_from_mam
{error,
  {{badrpc,timeout},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},service_domain_db,sync_local,[]],
      [{file,
         "/home/circleci/project/big_tests/../test/common/distributed_helper.erl"},
       {line,140}]},
    {service_domain_db_SUITE,sync_local,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1214}]},
    {service_domain_db_SUITE,sync,0,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1193}]},
    {service_domain_db_SUITE,
      '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,965}]},
    {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,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

service_domain_db_SUITE:db:rest_without_auth:rest_without_auth_parallel:rest_delete_domain_cleans_data_from_mam
{error,
  {{badrpc,timeout},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},service_domain_db,sync_local,[]],
      [{file,
         "/home/circleci/project/big_tests/../test/common/distributed_helper.erl"},
       {line,140}]},
    {service_domain_db_SUITE,sync_local,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1214}]},
    {service_domain_db_SUITE,sync,0,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1193}]},
    {service_domain_db_SUITE,
      '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,965}]},
    {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,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

service_domain_db_SUITE:db:rest_without_auth:rest_without_auth_parallel:rest_delete_domain_cleans_data_from_mam
{error,
  {{badrpc,
     {'EXIT',
       {{badmatch,
          {badrpc,
            {'EXIT',
              {timeout,
                {gen_server,call,[<10349.62465.0>,ping]}}}}},
        [{service_domain_db,'-sync_local/0-lc$^1/1-1-',1,
           [{file,
            "/home/circleci/project/src/domain/service_domain_db.erl"},
          {line,99}]},
         {service_domain_db,sync_local,0,
           [{file,
            "/home/circleci/project/src/domain/service_domain_db.erl"},
          {line,99}]}]}}},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},service_domain_db,sync_local,[]],
      [{file,
         "/home/circleci/project/big_tests/../test/common/distributed_helper.erl"},
       {line,140}]},
    {service_domain_db_SUITE,sync_local,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1214}]},
    {service_domain_db_SUITE,sync,0,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1193}]},
    {service_domain_db_SUITE,
      '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,965}]},
    {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,1794}]},
    {test_server,run_test_c...

Report log

service_domain_db_SUITE:db:rest_without_auth:rest_without_auth_parallel:rest_delete_domain_cleans_data_from_mam
{error,
  {{badrpc,timeout},
   [{distributed_helper,rpc,
      [#{node => mongooseim@localhost},service_domain_db,sync_local,[]],
      [{file,
         "/home/circleci/project/big_tests/../test/common/distributed_helper.erl"},
       {line,140}]},
    {service_domain_db_SUITE,sync_local,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1214}]},
    {service_domain_db_SUITE,sync,0,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,1193}]},
    {service_domain_db_SUITE,
      '-rest_delete_domain_cleans_data_from_mam/1-fun-0-',5,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,965}]},
    {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,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_mssql_mnesia_27 / odbc_mssql_mnesia / b94a8cf
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


small_tests_27_arm64 / small_tests / b94a8cf
Reports root / small

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.98%. Comparing base (87ce067) to head (85eb17d).
Report is 9 commits behind head on master.

Files Patch % Lines
src/domain/mongoose_domain_sql.erl 86.66% 2 Missing ⚠️
src/domain/service_domain_db.erl 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4362      +/-   ##
==========================================
+ Coverage   84.96%   84.98%   +0.01%     
==========================================
  Files         552      552              
  Lines       33697    33714      +17     
==========================================
+ Hits        28630    28651      +21     
+ Misses       5067     5063       -4     

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

@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 21, 2024

ldap_mnesia_26 / ldap_mnesia / 70b06f2
Reports root/ big
OK: 211 / Failed: 0 / User-skipped: 125 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 70b06f2
Reports root/ big
OK: 211 / Failed: 0 / User-skipped: 125 / Auto-skipped: 0


ldap_mnesia_27 / ldap_mnesia / 70b06f2
Reports root/ big
OK: 211 / Failed: 0 / User-skipped: 125 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 70b06f2
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 70b06f2
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 70b06f2
Reports root/ big
OK: 439 / Failed: 0 / User-skipped: 47 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 70b06f2
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 70b06f2
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / 70b06f2
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 70b06f2
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 70b06f2
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 70b06f2
Reports root/ big
OK: 3380 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


small_tests_27 / small_tests / 70b06f2
Reports root / small


mssql_mnesia_27 / odbc_mssql_mnesia / 70b06f2
Reports root/ big
OK: 3381 / Failed: 0 / User-skipped: 0 / Auto-skipped: 0


small_tests_27_arm64 / small_tests / 70b06f2
Reports root / small


small_tests_26 / small_tests / 70b06f2
Reports root / small

@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 21, 2024

elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 85eb17d
Reports root/ big
OK: 439 / Failed: 0 / User-skipped: 47 / Auto-skipped: 0


small_tests_26 / small_tests / 85eb17d
Reports root / small


small_tests_27_arm64 / small_tests / 85eb17d
Reports root / small


small_tests_27 / small_tests / 85eb17d
Reports root / small


ldap_mnesia_27 / ldap_mnesia / 85eb17d
Reports root/ big
OK: 2338 / Failed: 0 / User-skipped: 905 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 85eb17d
Reports root/ big
OK: 2338 / Failed: 0 / User-skipped: 905 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 85eb17d
Reports root/ big
OK: 4588 / Failed: 0 / User-skipped: 145 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 85eb17d
Reports root/ big
OK: 4621 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 85eb17d
Reports root/ big
OK: 4621 / Failed: 0 / User-skipped: 112 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 85eb17d
Reports root/ big
OK: 2478 / Failed: 0 / User-skipped: 765 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 85eb17d
Reports root/ big
OK: 4532 / Failed: 0 / User-skipped: 179 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 85eb17d
Reports root/ big
OK: 4618 / Failed: 0 / User-skipped: 115 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 85eb17d
Reports root/ big
OK: 5012 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / 85eb17d
Reports root/ big
OK: 4991 / Failed: 0 / User-skipped: 140 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 85eb17d
Reports root/ big
OK: 5012 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


mssql_mnesia_27 / odbc_mssql_mnesia / 85eb17d
Reports root/ big
OK: 5009 / Failed: 0 / User-skipped: 122 / Auto-skipped: 0

@arcusfelis arcusfelis marked this pull request as ready for review August 21, 2024 14:29
Copy link
Contributor

@jacekwegr jacekwegr left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for making those changes. This should help the CI run more smoothly.

@jacekwegr jacekwegr merged commit f7a862c into master Aug 22, 2024
4 checks passed
@jacekwegr jacekwegr deleted the domain-service-test-fix branch August 22, 2024 11:36
@jacekwegr jacekwegr added this to the 6.3.0 milestone Oct 3, 2024
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.

3 participants