CAICAIIs commented on code in PR #3180:
URL: https://github.com/apache/dubbo-go/pull/3180#discussion_r2724940427
##########
cluster/cluster/failback/cluster_test.go:
##########
@@ -147,14 +149,11 @@ func TestFailbackRetryFailed(t *testing.T) {
var wg sync.WaitGroup
retries := 2
wg.Add(retries)
- now := time.Now()
// add retry call that eventually failed.
for i := 0; i < retries; i++ {
- j := i + 1
invoker.EXPECT().Invoke(gomock.Any(),
gomock.Any()).DoAndReturn(func(context.Context, base.Invocation) result.Result {
- delta := time.Since(now).Nanoseconds() /
int64(time.Second)
- assert.GreaterOrEqual(t, delta, int64(5*j))
+ // with exponential backoff, retries happen with
increasing intervals starting from ~1s
wg.Done()
Review Comment:
指数间隔有个 Randomization Factor(随机抖动因子),让请求分散,时间断言的话容易引入 flaky test。比如预期
1s,实际可能是 0.8s 或 1.3s
--
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]