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

Fix flaky sm tests by making sid's unique #4103

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Conversation

chrzaszcz
Copy link
Member

Sid's should be created for different Pids - otherwise the timestamp alone does not guarantee uniqueness.

The sm tests started failing on fast machines, which could generate a lot of sid's in a single microsecond. On Apple M1 the small tests were failing all the time.

To fix this, spawn a new process when generating a sid in the tests. Forward incoming messages to the test process, because some tests need to check them.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.01% 🎉

Comparison is base (e6b9cc2) 83.88% compared to head (8b6f494) 83.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4103      +/-   ##
==========================================
+ Coverage   83.88%   83.89%   +0.01%     
==========================================
  Files         551      551              
  Lines       33594    33594              
==========================================
+ Hits        28180    28184       +4     
+ Misses       5414     5410       -4     

see 9 files with indirect coverage changes

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

Sid's should be created for different Pids - otherwise the timestamp
alone does not guarantee uniqueness.

The sm tests started failing on fast machines, which could generate a
lot of sid's in a single microsecond. On Apple M1 the small tests were
failing all the time.

To fix this, spawn a new process when generating a sid in the tests.
Forward incoming messages to the test process, because some tests need
to check them.
@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 17, 2023

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


small_tests_24 / small_tests / 8b6f494
Reports root / small


small_tests_25 / small_tests / 8b6f494
Reports root / small


small_tests_25_arm64 / small_tests / 8b6f494
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 8b6f494
Reports root/ big
OK: 2274 / Failed: 0 / User-skipped: 831 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 8b6f494
Reports root/ big
OK: 2274 / Failed: 0 / User-skipped: 831 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 8b6f494
Reports root/ big
OK: 4201 / Failed: 0 / User-skipped: 116 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 8b6f494
Reports root/ big
OK: 4233 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 8b6f494
Reports root/ big
OK: 4227 / Failed: 1 / User-skipped: 84 / Auto-skipped: 5

bosh_SUITE:essential_https:accept_higher_hold_value
{error,
  {{assertEqual,
     [{module,bosh_SUITE},
      {line,260},
      {expression,"get_bosh_sessions ( )"},
      {expected,[]},
      {value,
        [{bosh_session,<<"b2317b5a2c7df090881caf781cdbc7d03d9fc904">>,
           <9313.10152.0>}]}]},
   [{bosh_SUITE,accept_higher_hold_value,1,
      [{file,"/home/circleci/project/big_tests/tests/bosh_SUITE.erl"},
       {line,260}]},
    {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


internal_mnesia_25 / internal_mnesia / 8b6f494
Reports root/ big
OK: 2420 / Failed: 0 / User-skipped: 685 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 8b6f494
Reports root/ big
OK: 4230 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 8b6f494
Reports root/ big
OK: 4622 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


pgsql_cets_25 / pgsql_cets / 8b6f494
Reports root/ big
OK: 4592 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 8b6f494
Reports root/ big
OK: 4602 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 8b6f494
Reports root/ big
OK: 4622 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 8b6f494
Reports root/ big
OK: 4619 / Failed: 0 / User-skipped: 94 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 8b6f494
Reports root/ big
OK: 4233 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0

@chrzaszcz chrzaszcz marked this pull request as ready for review August 17, 2023 08:50
Copy link
Collaborator

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

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

I just checked that erlang:monotonic_time/X doesn't have a strictly increasing mode, so it can still generate repeated values ☹️ So yeah, there's no simpler way. This fix is cool, actually a very smart move with the start_link 👌🏽

@NelsonVides NelsonVides merged commit fc65036 into master Aug 17, 2023
4 checks passed
@NelsonVides NelsonVides deleted the fix-flaky-sm-tests branch August 17, 2023 13:03
@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.

3 participants