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

   ## What is the purpose of the change?
   Three tests under module `dubbo-common` are detected as Order-Dependent 
flaky tests:
   
`dubbo-common\src\test\java\org\apache\dubbo\common\threadpool\support\eager\TaskQueueTest.java#testOffer2`
   
`dubbo-common\src\test\java\org\apache\dubbo\common\threadpool\support\eager\TaskQueueTest.java#testOffer3`
   
`dubbo-common\src\test\java\org\apache\dubbo\common\threadpool\support\eager\TaskQueueTest.java#testOffer4`
   There exists circumstances which if queue or executor retain modifications 
from a previous test (e.g., adding elements or changing state), subsequent 
tests may inherit an altered state. Tests like testOffer3 and testOffer4 
manipulate executor properties such as pool size and active count. If they run 
in an order where a test expecting an empty state follows one that fills or 
modifies the queue, the test could fail or produce flaky results. 
   This approach modify TaskQueueTest class by defining queue and executor as 
class-level variables and initializing them in the @BeforeEach method to ensure 
each test starts with a fresh and consistent state. This approach prevents 
potential state contamination between tests, promoting better test isolation 
and reliability, also ensures that all tests share a consistent setup 
foundation.
   
   ## 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to