Skip to content

optimize: Remove hardcoded port configuration in test classes #7460

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

Open
wants to merge 10 commits into
base: 2.x
Choose a base branch
from

Conversation

WangzJi
Copy link
Contributor

@WangzJi WangzJi commented Jun 21, 2025

…ynamic port allocation

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Fixes: #7440

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@WangzJi WangzJi force-pushed the fix/7440-skipped-tests branch 3 times, most recently from be66539 to 40a02a1 Compare June 21, 2025 09:19
@WangzJi WangzJi marked this pull request as draft June 21, 2025 09:35
@WangzJi WangzJi force-pushed the fix/7440-skipped-tests branch from 40a02a1 to 56966ac Compare June 21, 2025 10:10
WangzJi added 3 commits June 21, 2025 18:37
# Conflicts:
#	test/src/test/java/org/apache/seata/core/rpc/netty/MsgVersionHelperTest.java
#	test/src/test/java/org/apache/seata/core/rpc/netty/RmNettyClientTest.java
#	test/src/test/java/org/apache/seata/core/rpc/netty/TmNettyClientTest.java
#	test/src/test/java/org/apache/seata/saga/engine/db/AbstractServerTest.java
#	test/src/test/java/org/apache/seata/saga/engine/db/StateMachineDBTests.java
Copy link

codecov bot commented Jun 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.20%. Comparing base (cbc6ac5) to head (856ba8c).

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7460      +/-   ##
============================================
- Coverage     60.21%   60.20%   -0.02%     
  Complexity      658      658              
============================================
  Files          1281     1281              
  Lines         48282    48282              
  Branches       5676     5676              
============================================
- Hits          29075    29066       -9     
- Misses        16602    16610       +8     
- Partials       2605     2606       +1     

see 6 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Create BaseNettyClientTest as a reusable test base class
- Refactor TmNettyClientTest, RmNettyClientTest, and MsgVersionHelperTest
- Use dynamic port allocation to prevent port conflicts
- Implement unified resource management and cleanup
- Support parallel test execution with isolated environments
@WangzJi WangzJi marked this pull request as ready for review June 21, 2025 12:54
@WangzJi
Copy link
Contributor Author

WangzJi commented Jun 21, 2025

@YongGoose
PTAL.

@YongGoose YongGoose self-requested a review June 22, 2025 14:26
@YongGoose
Copy link
Member

I’ve been a bit delayed in reviewing due to a busy schedule lately — sorry about that.

Overall, the code looks good and I didn’t notice any major issues.
However, I do have one question.

Last time we talked, we mentioned that mismatched port configurations were causing connection issues during test execution. Could I ask how you addressed that?

Also, regarding the CodeCov link in the issue — it might be good to recover the reduced test coverage.
Do you think that could be resolved through the current test refactoring?

@WangzJi
Copy link
Contributor Author

WangzJi commented Jun 23, 2025

Thanks for the follow-up!

Regarding the port configuration issue — I initially suspected it was caused by port conflicts, since the CodeCov link in the issue pointed to the server and core modules, and I did observe RM connection errors in the CI logs. However, I later found that other PRs did not show the same behavior as #7435 in their CodeCov reports, which suggests the issue is likely unrelated to the previous port mismatch we discussed.

After reviewing Codecov’s documentation on unexpected coverage changes, it seems more likely that this is caused by how indirect changes are reported, rather than a bug in the code itself.

If you have any suggestions on refining the test setup, I’d be happy to incorporate them!

@WangzJi WangzJi changed the title fix: Remove hardcoded port configuration in test classes optimize: Remove hardcoded port configuration in test classes Jun 24, 2025
@YongGoose
Copy link
Member

Thanks for the follow-up!

Regarding the port configuration issue — I initially suspected it was caused by port conflicts, since the CodeCov link in the issue pointed to the server and core modules, and I did observe RM connection errors in the CI logs. However, I later found that other PRs did not show the same behavior as #7435 in their CodeCov reports, which suggests the issue is likely unrelated to the previous port mismatch we discussed.

After reviewing Codecov’s documentation on unexpected coverage changes, it seems more likely that this is caused by how indirect changes are reported, rather than a bug in the code itself.

If you have any suggestions on refining the test setup, I’d be happy to incorporate them!

I think I’ll need to take a closer look at the logs myself.
It might take a bit of time 😅

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.

Some tests were skipped after recent changes(#7435)
2 participants