-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip sleep in VCR replaying mode #12785
base: main
Are you sure you want to change the base?
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @c2thorn, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
dfa7579
to
b002004
Compare
b002004
to
441f471
Compare
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
441f471
to
1656389
Compare
@@ -90,7 +91,10 @@ func SkipIfVcr(t *testing.T) { | |||
|
|||
func SleepInSecondsForTest(t int) resource.TestCheckFunc { | |||
return func(s *terraform.State) error { | |||
time.Sleep(time.Duration(t) * time.Second) | |||
// Assume we never want to sleep when we're in replaying mode. | |||
if os.Getenv("VCR_MODE") != "REPLAYING" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this both with / without assignment, but gut is that this is probably good enough? it already seems to work fine / not error if the env var is not defined.
In
SleepInSecondsForTest()
, skip the sleep whenVCR_MODE
isREPLAYING
. 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
Replaying mode with change:
without change (this one has a 5s sleep, so the difference is small, but you can see it more dramatically on something with a longer sleep)
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.