@@ -304,7 +304,6 @@ func TestManager_ManageVolume_exponentialBackOffRetryOnIssueErrors(t *testing.T)
304
304
expectGlobalTimeout := 2 * time .Second
305
305
306
306
var numOfRetries int32 = 0 // init
307
-
308
307
opts := newDefaultTestOptions (t )
309
308
opts .RenewalBackoffConfig = & wait.Backoff {
310
309
Duration : expBackOffDuration ,
@@ -313,16 +312,16 @@ func TestManager_ManageVolume_exponentialBackOffRetryOnIssueErrors(t *testing.T)
313
312
Jitter : expBackOffJitter ,
314
313
Steps : expBackOffSteps ,
315
314
}
316
- opts .ReadyToRequest = func (meta metadata.Metadata ) (bool , string ) {
317
- // ReadyToRequest will be called by issue()
318
- atomic .AddInt32 (& numOfRetries , 1 ) // run in a goroutine, thus increment it atomically
319
- return true , "" // AlwaysReadyToRequest
320
- }
321
315
m , err := NewManager (opts )
322
- m .issueRenewalTimeout = issueRenewalTimeout
323
316
if err != nil {
324
317
t .Fatal (err )
325
318
}
319
+ m .issueRenewalTimeout = issueRenewalTimeout
320
+ // Increment the 'numOfRetries' counter whenever issue() is called.
321
+ // TODO: replace usages of this function with reading from metrics.
322
+ m .doNotUse_CallOnEachIssue = func () {
323
+ atomic .AddInt32 (& numOfRetries , 1 ) // run in a goroutine, thus increment it atomically
324
+ }
326
325
327
326
// Register a new volume with the metadata store
328
327
store := opts .MetadataReader .(storage.Interface )
@@ -347,7 +346,7 @@ func TestManager_ManageVolume_exponentialBackOffRetryOnIssueErrors(t *testing.T)
347
346
348
347
actualNumOfRetries := atomic .LoadInt32 (& numOfRetries ) // read atomically
349
348
if actualNumOfRetries != expectNumOfRetries {
350
- t .Errorf ("expect %d of retires, but got %d" , expectNumOfRetries , actualNumOfRetries )
349
+ t .Errorf ("expect %d retires, but got %d" , expectNumOfRetries , actualNumOfRetries )
351
350
}
352
351
}
353
352
0 commit comments