Skip to content
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

Address dependency issues in TestAccFirestoreField_* tests #9957

Merged
merged 10 commits into from
Mar 5, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
UserAgent: config.UserAgent,
})
if err != nil {
return err
e := err.(*googleapi.Error)
if e.Code == 403 && strings.Contains(e.Message, "Cloud Firestore API has not been used in project") {
// The acceptance test has provisioned the resources under test in a new project, and the destory check is seeing the
// effects of the project not existing. This means the service isn't enabled, and that the resource is definitely destroyed.
// We do not return the error in this case - destroy was successful
return nil
}

// Return err in all other cases
return err
}

if v := res["indexConfig"]; v != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ resource "google_firestore_database" "database" {
location_id = "nam5"
type = "FIRESTORE_NATIVE"

depends_on = [google_project_service.firestore]
# used to control delete order
depends_on = [
google_project_service.firestore,
google_project.project
]
}
`, context)
} else {
Expand All @@ -115,7 +119,7 @@ resource "google_firestore_database" "database" {
type = "FIRESTORE_NATIVE"

delete_protection_state = "DELETE_PROTECTION_DISABLED"
deletion_policy = "DELETE"
deletion_policy = "DELETE"
}
`, context)
}
Expand Down
Loading