ljmcr opened a new pull request, #14900:
URL: https://github.com/apache/dubbo/pull/14900

   ## What is the purpose of the change?
   Two tests under module dubbo-common are detected as Order-Dependent flaky 
tests:
   `org.apache.dubbo.common.utils.DubboAppenderTest.testAvailable`
   `org.apache.dubbo.common.utils.DubboAppenderTest.testAppend`
   
   In this PR, I modified the test setup to ensure that each unit test starts 
with an independent state by resetting the DubboAppender in the @BeforeEach 
method. Currently, all tests rely on the tearDown() method annotated with 
@AfterEach to clear the state. However, in unit testing, it is essential for 
each test to be independent and not depend on the state left by previous tests. 
If a test fails in a way that prevents tearDown() from running (e.g., due to an 
unexpected exception or forced termination), it can result in residual state in 
logList, causing dependencies between tests and breaking test isolation.
   
   Additionally, I replaced assumeTrue() and assumeFalse() with assertThat() to 
ensure that tests fail with clear feedback when conditions are not met, rather 
than being skipped. Using assertions is better to report failures directly, 
rather than directly skipping a test when a condition is not met.
   
   ## Checklist
   - [x] Make sure there is a 
[GitHub_issue](https://github.com/apache/dubbo/issues) field for the change.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Write necessary unit-test to verify your logic correction. If the new 
feature or significant change is committed, please remember to add sample in 
[dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [x] Make sure gitHub actions can pass. [Why the workflow is failing and 
how to fix it?](./CONTRIBUTING.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to