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

Skip to content

Conversation

@OmCheeLin
Copy link
Contributor

@OmCheeLin OmCheeLin commented Jun 8, 2025

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

add UT for seata-spring-boot-starter module

Ⅱ. Does this pull request fix one issue?

fixes #7381

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Jun 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.43%. Comparing base (4aa446e) to head (d3e3c92).
Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7422      +/-   ##
============================================
+ Coverage     59.36%   59.43%   +0.07%     
- Complexity      531      543      +12     
============================================
  Files          1281     1281              
  Lines         46142    46142              
  Branches       5561     5561              
============================================
+ Hits          27390    27426      +36     
+ Misses        16188    16149      -39     
- Partials       2564     2567       +3     

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

@YongGoose YongGoose requested a review from Copilot June 8, 2025 13:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds unit tests for the seata-spring-boot-starter module to verify conditional bean registration across several auto-configuration classes, updates the POM to include necessary test dependencies, and logs the new tests in the changelogs.

  • Introduces new test classes for Saga, HTTP, DataSource, and core auto-configuration.
  • Updates pom.xml with Spring Boot test and servlet API dependencies.
  • Updates changelogs to record the addition of these tests.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
seata-spring-boot-starter/src/test/java/.../SeataSagaAutoConfigurationTest.java Adds tests for saga auto-configuration and async executor beans
seata-spring-boot-starter/src/test/java/.../SeataHttpAutoConfigurationTest.java Adds tests for HTTP auto-configuration under various scenarios
seata-spring-boot-starter/src/test/java/.../SeataDataSourceAutoConfigurationTest.java Adds tests for data source auto-configuration with properties
seata-spring-boot-starter/src/test/java/.../SeataAutoConfigurationTest.java Adds tests for core auto-configuration components
seata-spring-boot-starter/pom.xml Adds test dependencies (spring-boot-test, servlet APIs)
changes/zh-cn/2.x.md, changes/en-us/2.x.md Records the addition of these unit tests
Comments suppressed due to low confidence (3)

seata-spring-boot-starter/src/test/java/org/apache/seata/spring/boot/autoconfigure/SeataSagaAutoConfigurationTest.java:134

  • Consider adding a negative test case to verify that the async executor and rejected handler beans are not created when seata.saga.state-machine.enable-async is false, improving coverage for the disabled scenario.
assertThat(rejectedExecutionHandler).isInstanceOf(ThreadPoolExecutor.CallerRunsPolicy.class);

changes/en-us/2.x.md:83

  • [nitpick] Use 'unit tests' instead of 'UT' for clarity in the changelog entry.
- [[#7422](https://github.com/apache/incubator-seata/pull/7422)] add UT for seata-spring-boot-starter module

seata-spring-boot-starter/pom.xml:81

  • [nitpick] Including both jakarta.servlet-api and javax.servlet-api can cause classpath conflicts; consider consolidating to only the required servlet API dependency for tests.
<artifactId>jakarta.servlet-api</artifactId>


import static org.apache.seata.spring.boot.autoconfigure.SeataSagaAutoConfiguration.SAGA_ASYNC_THREAD_POOL_EXECUTOR_BEAN_NAME;
import static org.apache.seata.spring.boot.autoconfigure.SeataSagaAutoConfiguration.SAGA_REJECTED_EXECUTION_HANDLER_BEAN_NAME;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
Copy link

Copilot AI Jun 8, 2025

Choose a reason for hiding this comment

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

[nitpick] Mixed use of AssertionsForClassTypes.assertThat and AssertionsForInterfaceTypes.assertThat imports may confuse readers; consider unifying to a single assertion style for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +51
"seata.enableAutoDataSourceProxy=true",
"seata.enable-auto-data-source-proxy=true"
Copy link

Copilot AI Jun 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The test includes both camelCase and kebab-case property keys; it would be clearer to test only the actual property name supported by SeataProperties, reducing redundancy.

Suggested change
"seata.enableAutoDataSourceProxy=true",
"seata.enable-auto-data-source-proxy=true"
"seata.enableAutoDataSourceProxy=true"

Copilot uses AI. Check for mistakes.
* Tests for {@link SeataHttpAutoConfiguration} to verify conditional bean registration.
*/
public class SeataHttpAutoConfigurationTest {
// No thread safety issues, no need to create in @BeforeEach
Copy link

Copilot AI Jun 8, 2025

Choose a reason for hiding this comment

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

[nitpick] This comment about thread safety and @BeforeEach maintenance can be removed to reduce noise, as the test runner is inherently single-threaded by default.

Suggested change
// No thread safety issues, no need to create in @BeforeEach

Copilot uses AI. Check for mistakes.
@slievrly
Copy link
Member

slievrly commented Jun 8, 2025

@OmCheeLin thanks for your contribution.

@slievrly slievrly added this to the 2.5.0 milestone Jun 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.

LGTM

@slievrly slievrly merged commit c902076 into apache:2.x Jun 8, 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.

add UT for seata-spring-boot-starter module

2 participants