Skip to content

Commit

Permalink
Merge pull request #1340 from snyk/test/google_compute_global_address
Browse files Browse the repository at this point in the history
Add retry policy to google_compute_global_address acc test
  • Loading branch information
eliecharra authored Feb 1, 2022
2 parents 4051e58 + b9b06b3 commit fc821fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/resource/google/google_compute_global_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package google_test

import (
"testing"
"time"

"github.com/snyk/driftctl/test"
"github.com/snyk/driftctl/test/acceptance"
Expand All @@ -17,6 +18,16 @@ func TestAcc_Google_ComputeGlobalAddress(t *testing.T) {
},
Checks: []acceptance.AccCheck{
{
// New resources are not visible immediately through GCP API after an apply operation.
// Logic below retries driftctl scan using a back-off strategy of retrying 'n' times
// and doubling the amount of time waited after each one.
ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool {
if result.IsSync() || retryDuration > 10*time.Minute {
return false
}
time.Sleep((2 * time.Duration(retryCount)) * time.Minute)
return true
},
Check: func(result *test.ScanResult, stdout string, err error) {
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit fc821fc

Please sign in to comment.