test(acc): google_compute_instance_test

main
sundowndev 2022-02-14 10:44:06 +04:00
parent d256d98a1c
commit 88b09ac832
1 changed files with 11 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package google_test
import (
"testing"
"time"
"github.com/snyk/driftctl/test"
"github.com/snyk/driftctl/test/acceptance"
@ -17,6 +18,16 @@ func TestAcc_Google_ComputeInstance(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 > 15*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)