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

Run test-runner setup steps in parallel #4100

Merged
merged 3 commits into from
Aug 14, 2023
Merged

Run test-runner setup steps in parallel #4100

merged 3 commits into from
Aug 14, 2023

Conversation

arcusfelis
Copy link
Contributor

@arcusfelis arcusfelis commented Aug 14, 2023

This PR addresses "Faster local tests" MIM-2004.

Proposed changes include:

  • Rewrite wait_for_healthcheck script - now we run healthcheck command, instead of waiting for docker to run it. Saves 30 seconds for each DB start.

  • Run tasks in parallel in setup_db and test_runner.

  • Introduce tools/parallel.sh script.

  • It does not improve setup time on CircleCI, only locally.

The parallel tasks output would have a prefix (similar how docker-compose outputs):

....
redis:  Setting up db: redis
pgsql:  Setting up db: pgsql
pgsql:  Configuring postgres with SSL
build-tests:    cp ../test/mim_ct_rest.erl ../test/mim_ct_rest_handler.erl ../test/mim_ct_sup.erl src/
build-tests:    ../tools/silent_exec.sh "get-deps.log" ../rebar3 deps
build-mim:      Certificate will not expire
build-mim:      if [ "$SKIP_CERT_BUILD" = 1 ]; then \
build-mim:                      echo "Skip cert build"; \
build-mim:              else \
build-mim:                      cd tools/ssl && make; \
build-mim:              fi
pgsql stderr:   sudo: a password is required
build-mim:      chmod -R a+r mongooseim ca ca-clients
pgsql:  Failed to stop pgsql
build-mim:      building mim1
build-mim:      (. ./configure.out && \
build-mim:              DEVNODE=true ./tools/silent_exec.sh "mim1.log" ./rebar3 as mim1 release)
build-tests:    RUN: ../rebar3 deps
build-tests:    LOG: /Users/mikhailuvarov/erlang/esl/MongooseIM/big_tests/get-deps.log
build-tests:
build-mim:      RUN: ./rebar3 as mim1 release
build-mim:      LOG: /Users/mikhailuvarov/erlang/esl/MongooseIM/mim1.log
build-mim:
...

Of course, you can disable this optimization to use the old behaviour (for debugging, for example):

# --no-parallel flag example:
./tools/test-runner.sh --skip-small-tests --db redis pgsql --preset internal_mnesia --skip-cover  mod_global_distrib --no-parallel

Speeds things up, because by default it blocks for 30 seconds doing nothing
New tools/parallel.sh script
Sets up databases and build big_tests/releases in parallel
@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 14, 2023

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


small_tests_24 / small_tests / 212a65c
Reports root / small


small_tests_25_arm64 / small_tests / 212a65c
Reports root / small


small_tests_25 / small_tests / 212a65c
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 212a65c
Reports root/ big
OK: 2270 / Failed: 0 / User-skipped: 831 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 212a65c
Reports root/ big
OK: 2270 / Failed: 0 / User-skipped: 831 / Auto-skipped: 0


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


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


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


internal_mnesia_25 / internal_mnesia / 212a65c
Reports root/ big
OK: 2416 / Failed: 0 / User-skipped: 685 / Auto-skipped: 0


pgsql_cets_25 / pgsql_cets / 212a65c
Reports root/ big
OK: 4588 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 212a65c
Reports root/ big
OK: 4598 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 212a65c
Reports root/ big
OK: 4618 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 212a65c
Reports root/ big
OK: 4229 / Failed: 1 / User-skipped: 87 / Auto-skipped: 0

muc_SUITE:register:user_submits_registration_form
{error,
  {{assertion_failed,assert,is_iq_result,
     [{xmlel,<<"iq">>,
        [{<<"type">>,<<"set">>},
         {<<"id">>,<<"ad87a8d8c7dc399af1ced11d261b61c0">>},
         {<<"to">>,<<"groupchats.domain.example.com">>}],
        [{xmlel,<<"query">>,
           [{<<"xmlns">>,<<"jabber:iq:register">>}],
           [{xmlel,<<"x">>,
            [{<<"xmlns">>,<<"jabber:x:data">>},
             {<<"type">>,<<"submit">>}],
            [{xmlel,<<"field">>,
               [{<<"type">>,<<"hidden">>},
                {<<"var">>,<<"FORM_TYPE">>}],
               [{xmlel,<<"value">>,[],
                  [{xmlcdata,<<"jabber:iq:register">>}]}]},
             {xmlel,<<"field">>,
               [{<<"type">>,<<"text-single">>},
                {<<"var">>,<<"nick">>}],
               [{xmlel,<<"value">>,[],
                  [{xmlcdata,
                     <<"thirdwitchroom-c6ba027b94">>}]}]}]}]}]}],
     {xmlel,<<"iq">>,
       [{<<"from">>,<<"groupchats.domain.example.com">>},
        {<<"to">>,
         <<"alice_user_submits_registration_form_2748@domain.example.com/res1">>},
        {<<"type">>,<<"error">>},
        {<<"id">>,<<"ad87a8d8c7dc399af1ced11d261b61c0">>}],
       [{xmlel,<<"query">>,
          [{<<"xmlns">>,<<"jabber:iq:register">>}],
          [{xmlel,<<"x">>,
             [{<<"xmlns">>,<<"jabber:x:data">>},
            {<<"type">>,<<"submit">>}],
             [{xmlel,<<"field">>,
              [{<<"type">>,<<"hidden">>},
               {<<"var">>,<<"FORM_TYPE">>}],
      ...

Report log


pgsql_mnesia_25 / pgsql_mnesia / 212a65c
Reports root/ big
OK: 4618 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 212a65c
Reports root/ big
OK: 4615 / Failed: 0 / User-skipped: 94 / Auto-skipped: 0

muc_light_http_api_SUITE:end_per_suite
{error,
 {{unregistering_failed,
   {amount,1},
   {unregistered_items,
  [{{<<"_send_message_to_room_2645">>,
     [{escalus_event_mgr,<0.5467.2>},
    {tc_name,send_message_to_room},
    {escalus_cleaner,<0.5466.2>},
    {watchdog,<0.5465.2>},
    {preset,"odbc_mssql_mnesia"},
    {mim_data_dir,
     "/home/circleci/project/big_tests/tests/muc_light_http_api_SUITE_data"},
    {tc_logfile,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4100/187478/odbc_mssql_mnesia.25.3-amd64/big/ct_run.test%40ac0164c322b0.2023-08-14_12.26.48/big_tests.tests.muc_light_http_api_SUITE.logs/run.2023-08-14_12.41.01/muc_light_http_api_suite.send_message_to_room.212866.html"},
    {tc_group_properties,[{name,positive},parallel]},
    {tc_group_path,[]},
    {data_dir,
     "/home/circleci/project/big_tests/_build/default/lib/mongoose_tests/ebin/muc_light_http_api_SUITE_data/"},
    {priv_dir,
     "https://circleci-mim-results.s3.eu-central-1.amazonaws.com/PR/4100/187478/odbc_mssql_mnesia.25.3-amd64/big/ct_run.test%40ac0164c322b0.2023-08-14_12.26.48/big_tests.tests.muc_light_http_api_SUITE.logs/run.2023-08-14_12.41.01/log_private/"},
    {{saved_modules,mongooseim@localhost,<<"localhost">>},
     #{mod_adhoc => #{iqdisc => one_queue,report_commands_node => false},
       mod_amp => #{},
       mod_bosh =>
      #{backend => mnesia,inactivity => 30,max_pause => 120,
        max_wait => infinity,server_acks => false},
       mod_cache_users =>
      #{number_of_segments => 5,strategy => fifo,time_to_live => 2},
       mod_carboncopy => #{iqdisc => no_queue},
       mod_disco =>
      #{extra_domains => [],iq...

Report log


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

@codecov
Copy link

codecov bot commented Aug 14, 2023

Codecov Report

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

Comparison is base (0db93ef) 83.85% compared to head (212a65c) 83.87%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4100      +/-   ##
==========================================
+ Coverage   83.85%   83.87%   +0.01%     
==========================================
  Files         551      551              
  Lines       33558    33558              
==========================================
+ Hits        28141    28146       +5     
+ Misses       5417     5412       -5     

see 7 files with indirect coverage changes

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

@arcusfelis arcusfelis marked this pull request as ready for review August 14, 2023 14:35
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.

This is all shell magic, wish we could have all these things in a more sane scripting language, but anyway, it works and it is very useful 🔥

@NelsonVides NelsonVides merged commit f9dce47 into master Aug 14, 2023
4 checks passed
@NelsonVides NelsonVides deleted the faster-setup-db branch August 14, 2023 19:20
@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.

None yet

4 participants