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

Split tests #53

Merged
merged 30 commits into from
May 17, 2024
Merged

Split tests #53

merged 30 commits into from
May 17, 2024

Conversation

arcusfelis
Copy link
Contributor

@arcusfelis arcusfelis commented Mar 12, 2024

This PR addresses MIM-2187.

Separate cets_SUITE into parts

cets_SUITE is getting big, and big files are hard to understand/maintain.

  • Create helper modules. Put generic code there.
  • Split test cases into separate suites. Modules cets_join, cets_discovery and cets (contains insert/update operations) should be tested by different suites.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.80%. Comparing base (059078d) to head (06d99a8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #53      +/-   ##
==========================================
+ Coverage   98.68%   98.80%   +0.11%     
==========================================
  Files          11       11              
  Lines         834      834              
==========================================
+ Hits          823      824       +1     
+ Misses         11       10       -1     

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

@arcusfelis arcusfelis force-pushed the cets-split-tests branch 2 times, most recently from c98d019 to 4f5b0de Compare May 14, 2024 15:58
cover logic is broken in Erlang 26. So, peer:stop/1 should not be called
Copy link
Contributor

@gustawlippa gustawlippa left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Moves the suites to different suites in a sensible manner, and introduces relevant helpers, it's a great effort!
I've left some minor comments, mostly about unused import statements, and maybe moving some helper functions around.
I didn't really look into the test logic, but from what I see the tests are mostly moved around and the new changes make sense to me 👍

test/cets_SUITE.erl Outdated Show resolved Hide resolved
test/cets_SUITE.erl Outdated Show resolved Hide resolved
State#{other_servers := Servers}
end).

set_join_ref(Pid, JoinRef) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe if one testcase is moved from cets_SUITE to cets_join_SUITE this could be moved to cets_join_SUITE as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like suites contain test cases, helpers could go into a separate file

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I don't mind that. 👍
I just worry a bit with a general test helper, it may contain everything but the kitchen sink after some time, but it also makes sense to keep the suites clean.

@@ -0,0 +1,37 @@
-module(cets_test_helper).
Copy link
Contributor

Choose a reason for hiding this comment

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

I must admit I'm not a fan of a general helper, especially if there are specific helpers, but I'm not sure how to fix this.
I've left some comments which may make sense if we reshuffle some testcases, but I also understand if we want to move helper functions out of the *_SUITE files altogether - then this module is needed as it is I believe.

test/cets_join_SUITE.erl Outdated Show resolved Hide resolved
test/cets_test_peer.erl Outdated Show resolved Hide resolved
test/cets_test_peer.erl Outdated Show resolved Hide resolved
test/cets_netsplit_SUITE.erl Outdated Show resolved Hide resolved
test/cets_join_SUITE.erl Outdated Show resolved Hide resolved
test/cets_status_SUITE.erl Outdated Show resolved Hide resolved
@gustawlippa gustawlippa merged commit 779f136 into main May 17, 2024
9 checks passed
@gustawlippa gustawlippa deleted the cets-split-tests branch May 17, 2024 07:40
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.

2 participants