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

Start cover on mim1 - second version #4345

Merged
merged 7 commits into from
Jul 30, 2024
Merged

Conversation

arcusfelis
Copy link
Contributor

@arcusfelis arcusfelis commented Jul 29, 2024

This PR addresses "MIM-2267 Meck fails to restore coverage if it is run not on the main node".

Proposed changes include:

  • Meck is broken for distributed cover. It does not reactivate cover after meck:unload/1. See Use module instead of meck in amp_big #4328 as a proof of significant coverage improvement after removing mecking from one of the modules.
    Meck still works well, if we enable cover on each node separately - this means slow cover:do_compile_beam/2 executed on each node...

Erlang 27 has Jit and cover uses jit for native coverage (this means there are changes to cover.erl that make Meck never returning when it mocks something on NOT the main node).
Ensure you see jit in the line:

Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

More info:

We used the test to ensure meck and cover work on erlang27:

cover_is_preserved_(#{mod := Mod, peers := [Peer, Peer2|_], nodes := [Node, Node2|_]}) ->
    %% Start local cover on Node1
    {ok, [Node2]} = peer:call(Peer, cover, start, [[Node, Node2]]),
    {ok, Mod} = peer:call(Peer, cover, compile_beam, [Mod]),
    {file, _} = peer:call(Peer, cover, is_compiled, [Mod]),
    ok = peer:call(Peer2, Mod, bump, [1]),
    ok = peer:call(Peer, Mod, bump, [999]),
    assert_called(Peer, {Mod, call, 0}, 1000),
    ok = peer:call(Peer, meck, new, [Mod, [passthrough, no_link]]),
    ok = peer:call(Peer, meck, unload, [Mod]),
    ok = peer:call(Peer, Mod, bump, [333]),
    assert_called(Peer, {storedmod, call, 0}, 1333),
    ok = peer:call(Peer2, Mod, bump, [125]),
    assert_called(Peer, {storedmod, call, 0}, 1333 + 125),
    ok = peer:call(Peer, cover, stop, [Node]),
    ok.

TLDR:

  • we use distributed cover, that saves 2 or 3 minutes compiling all the cover modules on all MIM nodes.
  • meck does not work on the follover cover nodes - it only knows how to talk to the main node.
  • Do not use meck on mim2, mim3, fed, reg.
  • because mim1 contacts reg1, we now have issue with conflict tables. See block_nodes.
  • deduplicate_cover_server_console_prints removed.
  • One central function for cover interactions:
cover_call(CoverNode, Fun, Args) ->
    rpc:call(CoverNode, cover, Fun, Args).
    
% could be that to reproduce the old behaviour before this PR
cover_call(CoverNode, Fun, Args) ->
    rpc:call(node(), cover, Fun, Args).    

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.88%. Comparing base (9fb5603) to head (8cf7c10).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4345      +/-   ##
==========================================
+ Coverage   84.33%   84.88%   +0.55%     
==========================================
  Files         553      553              
  Lines       33730    33730              
==========================================
+ Hits        28445    28632     +187     
+ Misses       5285     5098     -187     

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

@mongoose-im

This comment was marked as outdated.

@arcusfelis arcusfelis changed the title Start cover on mim1 - v7 Start cover on mim1 - second version Jul 30, 2024
@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

So CETS would not put reg into a list of conflicted nodes of mim1
This is how it looks in codecov.json:
"":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,0,null,null,0]

Update rebar3_codecov with a fix

Failed modules are meck generates ones: mongoose_mam_id_meck_original
@mongoose-im

This comment was marked as outdated.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Jul 30, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 8cf7c10
Reports root/ big
OK: 439 / Failed: 0 / User-skipped: 47 / Auto-skipped: 0


small_tests_25 / small_tests / 8cf7c10
Reports root / small


small_tests_26 / small_tests / 8cf7c10
Reports root / small


small_tests_26_arm64 / small_tests / 8cf7c10
Reports root / small


ldap_mnesia_25 / ldap_mnesia / 8cf7c10
Reports root/ big
OK: 2337 / Failed: 0 / User-skipped: 905 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 8cf7c10
Reports root/ big
OK: 2337 / Failed: 0 / User-skipped: 905 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / 8cf7c10
Reports root/ big
OK: 4588 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 8cf7c10
Reports root/ big
OK: 4618 / Failed: 1 / User-skipped: 111 / Auto-skipped: 2

metrics_c2s_SUITE:single:presence_one
{error,
  {{xmppPresenceReceived,
     {value,3482},
     [{times,25,
        {error,
          {badmatch,{value,3483}},
          [{metrics_helper,assert_counter,3,
             [{file,
              "/home/circleci/project/big_tests/tests/metrics_helper.erl"},
            {line,36}]},
           {mongoose_helper,do_wait_until,2,
             [{file,
              "/home/circleci/project/big_tests/../test/common/mongoose_helper.erl"},
            {line,362}]},
           {metrics_c2s_SUITE,'-presence_one/1-fun-0-',1,
             [{file,
              "/home/circleci/project/big_tests/tests/metrics_c2s_SUITE.erl"},
            {line,125}]},
           {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}]}]}}],
     ok},
   [{mongoose_helper,do_wait_until,2,
      [{file,
         "/home/circleci/project/big_tests/../test/common/mongoose_helper.erl"},
       {line,359}]},
    {metrics_c2s_SUITE,'-presence_one/1-fun-0-',1,
      [{file,
         "/home/circleci/project/big_tests/tests/metrics_c2s_SUITE.erl"},
       {line,125}]},
    {escalus_story,story,4,
      [{file,
         "/...

Report log


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 8cf7c10
Reports root/ big
OK: 4621 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 8cf7c10
Reports root/ big
OK: 4618 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / 8cf7c10
Reports root/ big
OK: 2477 / Failed: 0 / User-skipped: 765 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / 8cf7c10
Reports root/ big
OK: 4532 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 8cf7c10
Reports root/ big
OK: 5012 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 8cf7c10
Reports root/ big
OK: 5012 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / 8cf7c10
Reports root/ big
OK: 4991 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / 8cf7c10
Reports root/ big
OK: 5009 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 8cf7c10
Reports root/ big
OK: 4621 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0

@arcusfelis arcusfelis marked this pull request as ready for review July 30, 2024 12:53
Copy link
Contributor

@JanuszJakubiec JanuszJakubiec 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 👍🏻

@JanuszJakubiec JanuszJakubiec merged commit 9632038 into master Jul 30, 2024
4 checks passed
@JanuszJakubiec JanuszJakubiec deleted the start-cover-on-mim1-v7 branch July 30, 2024 13:21
@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.

4 participants