From cc1f746c1d52401fe96914823526462ebce5f52b Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 24 Jan 2025 16:35:05 +0000 Subject: [PATCH] Skipped sleep in VCR replaying mode (#12785) [upstream:88e529230a7fa7f13f618e78ddf08782f1ec7a8c] Signed-off-by: Modular Magician --- .changelog/12785.txt | 3 +++ google/acctest/resource_test_utils.go | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 .changelog/12785.txt diff --git a/.changelog/12785.txt b/.changelog/12785.txt new file mode 100644 index 00000000000..42b910df155 --- /dev/null +++ b/.changelog/12785.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` \ No newline at end of file diff --git a/google/acctest/resource_test_utils.go b/google/acctest/resource_test_utils.go index a7829591bd0..18caa825393 100644 --- a/google/acctest/resource_test_utils.go +++ b/google/acctest/resource_test_utils.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "os" "slices" "testing" "time" @@ -92,6 +93,10 @@ func SkipIfVcr(t *testing.T) { func SleepInSecondsForTest(t int) resource.TestCheckFunc { return func(s *terraform.State) error { + // Assume we never want to sleep when we're in replaying mode. + if IsVcrEnabled() && os.Getenv("VCR_MODE") == "REPLAYING" { + return nil + } time.Sleep(time.Duration(t) * time.Second) return nil }