Similar to tests dependent on environment variables like GOOGLE_ORG having a value, we should check for a variable like GOOGLE_CI_ENVIRONMENT=true, skipping the test if not enabled. That'll mean that contributors can run resource suites locally successfully, and if they need to run these advanced tests they can break glass by providing the specific env var.
As discussed in @wyardley's comment- we could consider adding a gate on some particularly high cost (possibly just within an otherwise lower cost product) as well, whether it's one or multiple vars.
What kind of contribution is this issue about?
Other (specify in details)
Details
Tests like https://github.com/hashicorp/terraform-provider-google/blob/2152e73761c19c29d30ad5c8257640eb2d576a53/google/services/pubsub/resource_pubsub_topic_generated_test.go#L188 can only pass in CI, and will always fail locally, preventing developers from using resource wildcards (i.e.
TestAccComputeInstance_
) to run tests, forcing them to run them one-by-one.Similar to tests dependent on environment variables like GOOGLE_ORG having a value, we should check for a variable like GOOGLE_CI_ENVIRONMENT=true, skipping the test if not enabled. That'll mean that contributors can run resource suites locally successfully, and if they need to run these advanced tests they can break glass by providing the specific env var.
References
No response