Skip to content

Commit e83fbee

Browse files
committed
combine t.Error into a single t.Fatal and indent
1 parent 4ac6f4c commit e83fbee

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

credentials/jwt/jwt_token_file_call_creds_test.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -478,25 +478,23 @@ func (s) TestTokenFileCallCreds_BackoffBehavior(t *testing.T) {
478478
// and the backoff has expired.
479479
_, err = creds.GetRequestMetadata(ctx)
480480
if err != nil {
481-
t.Errorf("After creating valid token file, GetRequestMetadata() should eventually succeed, but got: %v", err)
482-
t.Error("Backoff should expire and trigger new attempt on next RPC")
483-
} else {
484-
// If successful, verify error cache and backoff state were cleared.
485-
impl.mu.Lock()
486-
clearedErr := impl.cachedError
487-
retryAttempt := impl.retryAttempt
488-
nextRetryTime := impl.nextRetryTime
489-
impl.mu.Unlock()
490-
491-
if clearedErr != nil {
492-
t.Errorf("After successful retry, cached error should be cleared, got: %v", clearedErr)
493-
}
494-
if retryAttempt != 0 {
495-
t.Errorf("After successful retry, retry attempt should be reset, got: %d", retryAttempt)
496-
}
497-
if !nextRetryTime.IsZero() {
498-
t.Error("After successful retry, next retry time should be cleared")
499-
}
481+
t.Fatalf("After creating valid token file, backoff should expire and trigger a token reload on the next RPC. GetRequestMetadata() should eventually succeed, but got: %v", err)
482+
}
483+
// If successful, verify error cache and backoff state were cleared.
484+
impl.mu.Lock()
485+
clearedErr := impl.cachedError
486+
retryAttempt = impl.retryAttempt
487+
nextRetryTime = impl.nextRetryTime
488+
impl.mu.Unlock()
489+
490+
if clearedErr != nil {
491+
t.Errorf("After successful retry, cached error should be cleared, got: %v", clearedErr)
492+
}
493+
if retryAttempt != 0 {
494+
t.Errorf("After successful retry, retry attempt should be reset, got: %d", retryAttempt)
495+
}
496+
if !nextRetryTime.IsZero() {
497+
t.Error("After successful retry, next retry time should be cleared")
500498
}
501499
}
502500

0 commit comments

Comments
 (0)