Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@charlhhhh
Copy link
Contributor

Why

This PR addresses #1714 to improve test coverage for the seata-rm-datasource module, particularly the org.apache.seata.rm package, which had low method and line coverage.

Before:

  • Package org.apache.seata.rm: 42% line coverage
  • Class BaseDataSourceResource: Not explicitly tested

After:

  • Package org.apache.seata.rm: 73% line coverage
  • Improved method and line coverage for BaseDataSourceResource

What

  • Added targeted unit tests for the abstract class BaseDataSourceResource using:
    • A dummy implementation DummyHoldable to simulate holdable resource state.
    • A subclass DummyResource to override abstract methods (e.g., getConnection).
  • Verified behavior of key methods:
    • hold(), release(), lookup()
    • Resource-related setters and getters
    • Branch status cache operations
  • Mocked required dependencies using Mockito and followed Seata’s test structure and style.

How to Verify

Run:

./mvnw clean test jacoco:report -pl rm

Then open the coverage report at:

rm/target/site/jacoco/index.html

Note: I have read the contributing guidelines and followed the testing structure and code style.

@slievrly slievrly changed the title Test/rm datasource coverage test: add UT for rm datasource module Apr 8, 2025
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

Pls. add license header.

@codecov
Copy link

codecov bot commented Apr 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.33%. Comparing base (0495f83) to head (2ee7e5f).
Report is 2 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7275      +/-   ##
============================================
+ Coverage     54.26%   54.33%   +0.06%     
- Complexity     7267     7280      +13     
============================================
  Files          1178     1178              
  Lines         41962    41962              
  Branches       4923     4923              
============================================
+ Hits          22772    22799      +27     
+ Misses        17038    17007      -31     
- Partials       2152     2156       +4     

see 4 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.

@charlhhhh
Copy link
Contributor Author

Hi @slievrly, I've added the license header as requested. Please take another look when convenient. Thanks!

@slievrly slievrly added this to the 2.5.0 milestone Apr 27, 2025
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@slievrly slievrly merged commit d58fa2d into apache:2.x Apr 27, 2025
9 checks passed
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
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