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

Refactor mam suite #4237

Merged
merged 4 commits into from
Mar 8, 2024
Merged

Refactor mam suite #4237

merged 4 commits into from
Mar 8, 2024

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Mar 7, 2024

The goal of this PR is to reduce code repetition and improve maintainability in mam_SUITE, making it possible to easily introduce instrumentation tests.

  • Export all functions.
  • Rework init_per_testcase and end_per_testcase.

@mongoose-im

This comment was marked as outdated.

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.37%. Comparing base (fd0720d) to head (5ea8c57).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4237      +/-   ##
==========================================
+ Coverage   84.00%   84.37%   +0.36%     
==========================================
  Files         552      552              
  Lines       33531    33531              
==========================================
+ Hits        28169    28293     +124     
+ Misses       5362     5238     -124     

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

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

We do this for other suites, and the long export lists are
tedious to maintain.
This simplifies test initialisation, and makes the whole setup more
predictable.
@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

Reasons: code reuse, DRY, maintainability

Also:
- Rework and simplify end_per_testcase
- Minor fix: don't start room for a few non-MUC cases
@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 8, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 5ea8c57
Reports root/ big
OK: 429 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / 5ea8c57
Reports root / small


small_tests_26 / small_tests / 5ea8c57
Reports root / small


small_tests_26_arm64 / small_tests / 5ea8c57
Reports root / small


ldap_mnesia_25 / ldap_mnesia / 5ea8c57
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / 5ea8c57
Reports root/ big
OK: 4469 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 5ea8c57
Reports root/ big
OK: 2275 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 5ea8c57
Reports root/ big
OK: 4502 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 5ea8c57
Reports root/ big
OK: 4502 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / 5ea8c57
Reports root/ big
OK: 2415 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / 5ea8c57
Reports root/ big
OK: 4425 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / 5ea8c57
Reports root/ big
OK: 4870 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 5ea8c57
Reports root/ big
OK: 4499 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 5ea8c57
Reports root/ big
OK: 4891 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 5ea8c57
Reports root/ big
OK: 4891 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / 5ea8c57
Reports root/ big
OK: 4887 / Failed: 1 / User-skipped: 121 / Auto-skipped: 0

sm_SUITE:ping_timeout
{error,{noproc,{gen_server,call,[<0.95254.0>,get_sm_h]}}}

Report log


mssql_mnesia_26 / odbc_mssql_mnesia / 5ea8c57
Reports root/ big
OK: 4888 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0

@chrzaszcz chrzaszcz marked this pull request as ready for review March 8, 2024 09:23
Copy link
Contributor

@arcusfelis arcusfelis left a comment

Choose a reason for hiding this comment

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

looks fine

Comment on lines +784 to +788
fresh_users(C) ->
case lists:member(C, all_cases_with_room()) of
true -> [{alice, 1}, {bob, 1}];
false -> []
end.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sometimes we have a list of cases and we check membership, some others we have a macro with a list of conditions, and in another one we have the list of conditions without the macro, directly coded into the clause. Can we have the clauses more consistent? Perhaps a map where the keys are the test cases and the values are configs as maps for the case? Maybe that is also repetitive, but requires_pm_archive preparing three users one of which is carol is not descriptive enough either 🤔

Just thinking out loud, this suite is really huge and complex, it won't be obvious how to clean it all up at once.

Copy link
Member Author

@chrzaszcz chrzaszcz Mar 8, 2024

Choose a reason for hiding this comment

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

I wanted to have it short and concise, and I tested different options, and this one was the shortest one.
Are the clauses really hard to understand for you? Maps with keys would be a lot of additional boilerplate code.
The macro requires_pm_archive prepares three users, because bootstrap_archive needs exactly these three users.

There is consistency:

  • macro is used when the list of conditions repeats,
  • there is only one list: all_cases_with_room, because this is the only case where I could use already existing groups of cases without creating new ones - and I didn't want to create groups with overlap, because they would be confusing.
  • in other cases, I explicitly listed the test cases.

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.

All right then, good step in the right direction 👌🏽

@NelsonVides NelsonVides merged commit f7eeadd into master Mar 8, 2024
4 checks passed
@NelsonVides NelsonVides deleted the refactor-mam-suite branch March 8, 2024 11:34
@jacekwegr jacekwegr added this to the 6.2.1 milestone Apr 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.

5 participants