Skip to content

Commit b002004

Browse files
committed
Skip sleep in VCR replaying mode
In `SleepInSecondsForTest()`, skip the sleep when `VCR_MODE` is `REPLAYING`. This makes the assumption that the sleep is always related to a condition that's already mitigated by the fact that we're using prerecorded fixtures, but it could be extended later to override this behavior if necessary. Fixes hashicorp/terraform-provider-google#20916
1 parent b5bdbf8 commit b002004

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mmv1/third_party/terraform/acctest/resource_test_utils.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ func SkipIfVcr(t *testing.T) {
9090

9191
func SleepInSecondsForTest(t int) resource.TestCheckFunc {
9292
return func(s *terraform.State) error {
93-
time.Sleep(time.Duration(t) * time.Second)
93+
// Assume we never want to sleep when we're in replaying mode.
94+
vcrMode := os.Getenv("VCR_MODE")
95+
if vcrMode == "REPLAYING" {
96+
time.Sleep(time.Duration(t) * time.Second)
97+
}
9498
return nil
9599
}
96100
}

0 commit comments

Comments
 (0)