CAICAIIs opened a new pull request, #3187:
URL: https://github.com/apache/dubbo-go/pull/3187

   #### Description
   Stabilize flaky tests in `cluster/cluster/failback` package that were caused 
by #3180 (exponential backoff for retry mechanism).
   #### Problem
   After #3180 merged, the failback cluster tests (`TestFailbackRetryFailed`, 
`TestFailbackRetryFailed10Times`) became flaky in CI due to:
   1. **Non-deterministic timing**: Exponential backoff with randomization 
factor produces variable retry intervals (e.g., 450ms ~ 1.6s instead of fixed 
5s)
   2. **WaitGroup race condition**: Original tests used `wg.Add(N)` with fixed 
`N` expectations, but actual retry count varies due to jitter
   3. **Time-based assertions**: `assert.GreaterOrEqual(t, delta, int64(1))` 
fails when randomization produces intervals < 1s
   #### Solution
   - Replace `sync.WaitGroup` with `atomic.Int64` counter for retry tracking
   - Use `MinTimes(N)` instead of `Times(N)` for gomock expectations
   - Remove time-based assertions incompatible with randomization factor
   - Use polling loop to wait for expected retry count
   #### Testing
   - Ran `go test -count=10` locally: **all 10 runs passed** (previously failed 
intermittently)
   - Full failback test suite passes
   
   ### Checklist
   - [x] I confirm the target branch is `develop`
   - [x] Code has passed local testing
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


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