Merge pull request #1345 from snyk/fix/acc_google_bigquery_table_test

Update retry policy for GCP acc tests
main
Raphaël 2022-02-11 14:39:57 +04:00 committed by GitHub
commit d256d98a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -22,7 +22,7 @@ func TestAcc_Google_BigqueryTable(t *testing.T) {
// Logic below retries driftctl scan using a back-off strategy of retrying 'n' times // Logic below retries driftctl scan using a back-off strategy of retrying 'n' times
// and doubling the amount of time waited after each one. // and doubling the amount of time waited after each one.
ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool { ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool {
if result.IsSync() || retryDuration > 10*time.Minute { if result.IsSync() || retryDuration > 15*time.Minute {
return false return false
} }
time.Sleep((2 * time.Duration(retryCount)) * time.Minute) time.Sleep((2 * time.Duration(retryCount)) * time.Minute)

View File

@ -22,7 +22,7 @@ func TestAcc_Google_ComputeGlobalAddress(t *testing.T) {
// Logic below retries driftctl scan using a back-off strategy of retrying 'n' times // Logic below retries driftctl scan using a back-off strategy of retrying 'n' times
// and doubling the amount of time waited after each one. // and doubling the amount of time waited after each one.
ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool { ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool {
if result.IsSync() || retryDuration > 10*time.Minute { if result.IsSync() || retryDuration > 15*time.Minute {
return false return false
} }
time.Sleep((2 * time.Duration(retryCount)) * time.Minute) time.Sleep((2 * time.Duration(retryCount)) * time.Minute)

View File

@ -438,7 +438,10 @@ func Run(t *testing.T, c AccTestCase) {
if check.ShouldRetry == nil || !check.ShouldRetry(result, time.Since(timeBeforeRetry), retryCount) { if check.ShouldRetry == nil || !check.ShouldRetry(result, time.Since(timeBeforeRetry), retryCount) {
break break
} }
logrus.WithField("count", fmt.Sprintf("%d", retryCount)).Debug("Retrying scan ...") logrus.
WithField("count", fmt.Sprintf("%d", retryCount)).
WithField("retry_duration", time.Since(timeBeforeRetry).Round(time.Second)).
Debug("Retrying scan ...")
_, _, _ = runDriftCtlCmd(driftctlCmd) _, _, _ = runDriftCtlCmd(driftctlCmd)
result = c.getResult(t) result = c.getResult(t)
retryCount++ retryCount++