Skip to content

Commit

Permalink
Add wait in TestAccAppEngineStandardAppVersion_update test to avoid…
Browse files Browse the repository at this point in the history
… 'API has not been used in project' error (GoogleCloudPlatform#10076)

* Add wait in acc test to avoid 'API has not been used in project' error

* Add external provider `time`

* Fix defect when referencing google_project resource
  • Loading branch information
SarahFrench authored and BBBmau committed Mar 6, 2024
1 parent 9d15eb3 commit 7061233
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ func TestAccAppEngineStandardAppVersion_update(t *testing.T) {
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckAppEngineStandardAppVersionDestroyProducer(t),
ExternalProviders: map[string]resource.ExternalProvider{
"time": {},
},
CheckDestroy: testAccCheckAppEngineStandardAppVersionDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccAppEngineStandardAppVersion_python(context),
Expand Down Expand Up @@ -161,11 +164,20 @@ resource "google_project_service" "project" {
disable_dependent_services = false
}
resource "time_sleep" "wait_60_seconds" {
depends_on = [google_project.my_project]
create_duration = "60s"
}
resource "google_project_service" "vpcaccess_api" {
project = google_project.my_project.project_id
service = "vpcaccess.googleapis.com"
disable_dependent_services = false
# Needed for CI tests for permissions to propagate, should not be needed for actual usage
depends_on = [time_sleep.wait_60_seconds]
}
resource "google_vpc_access_connector" "bar" {
Expand Down

0 comments on commit 7061233

Please sign in to comment.