annhchen89 opened a new pull request, #6261:
URL: https://github.com/apache/shenyu/pull/6261

   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   ### What is the purpose of the change
   Fixes an order-dependent (OD) flaky test in `Resilience4JPluginTest` by 
preventing`normalTest` from being affected by fallback execution triggered 
in`rateLimiterTest`.
   
   `Resilience4JPluginTest` contains three tests:
   
   - `rateLimiterTest` (polluter)
   - `circuitBreakerTest`
   - `normalTest` (victim)
   
   In `rateLimiterTest`, the following line executes a real Resilience4J 
rate-limiter error:
   
   ```java
   Mono.error(RequestNotPermitted.createRequestNotPermitted(rateLimiter))
   ```
   This forces the RateLimiterExecutor to execute the Resilience4J rate-limiter 
error path and fallback logic. So when normalTest runs after it, fallback is 
executed again, violating verifyComplete() and causing an order-dependent 
failure.
   
   ### The Fix
   
   The fix mocks ```RateLimiterExecutor.run()``` in normalTest to return 
```Mono.empty()```, this prevents execution of the Resilience4J rate-limiter 
error path and fallback logic, ensuring ```normalTest``` completes normally 
regardless of test execution order.
   
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.
   


-- 
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]

Reply via email to