From 69ded33e06f82134c826cf4fb9135b9c0bce343c Mon Sep 17 00:00:00 2001 From: sundowndev Date: Mon, 3 Jan 2022 11:20:23 +0400 Subject: [PATCH] test(acc): google_bigquery_dataset Add retry policy to the acceptance test for google_bigquery_dataset resource. --- pkg/resource/google/google_bigquery_dataset_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/resource/google/google_bigquery_dataset_test.go b/pkg/resource/google/google_bigquery_dataset_test.go index c5b6edf3..1c17f3ff 100644 --- a/pkg/resource/google/google_bigquery_dataset_test.go +++ b/pkg/resource/google/google_bigquery_dataset_test.go @@ -2,6 +2,7 @@ package google_test import ( "testing" + "time" "github.com/snyk/driftctl/test" "github.com/snyk/driftctl/test/acceptance" @@ -17,6 +18,11 @@ func TestAcc_Google_BigqueryDataset(t *testing.T) { }, Checks: []acceptance.AccCheck{ { + // New resources are not visible immediately on GCP api after an apply operation + // Logic below retry driftctl scan until we can retrieve the results (infra will be in sync) and for maximum 60 seconds + ShouldRetry: func(result *test.ScanResult, retryDuration time.Duration, retryCount uint8) bool { + return !result.IsSync() && retryDuration < time.Minute + }, Check: func(result *test.ScanResult, stdout string, err error) { if err != nil { t.Fatal(err)