Skip to content

Commit

Permalink
Fix nightly test failure of billing_project related acceptance tests (
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahFrench authored Oct 24, 2024
1 parent 1a4d3ca commit ca3f2ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func testAccSdkProvider_billing_project_emptyStringValidation(t *testing.T) {
}

func testAccSdkProvider_billing_project_useWithAndWithoutUserProjectOverride(t *testing.T) {
// Test does interact with APIs but experienced errors when run in VCR mode
// See: https://github.com/GoogleCloudPlatform/magic-modules/pull/11610#discussion_r1783271457
// Test cannot run in VCR mode due to use of aliases
// See: https://github.com/hashicorp/terraform-provider-google/issues/20019
acctest.SkipIfVcr(t)

randomString := acctest.RandString(t, 10)
Expand Down Expand Up @@ -186,8 +186,8 @@ func testAccSdkProvider_billing_project_useWithAndWithoutUserProjectOverride(t *
}

func testAccSdkProvider_billing_project_affectedByClientLibraryEnv(t *testing.T) {
// Test does interact with APIs but experienced errors when run in VCR mode
// See: https://github.com/GoogleCloudPlatform/magic-modules/pull/11610#issuecomment-2432649993
// Test cannot run in VCR mode due to use of aliases
// See: https://github.com/hashicorp/terraform-provider-google/issues/20019
acctest.SkipIfVcr(t)

randomString := acctest.RandString(t, 10)
Expand Down Expand Up @@ -261,6 +261,13 @@ resource "google_project" "project" {
billing_account = "%{billing_account}"
deletion_policy = "DELETE"
}
resource "google_project_service" "serviceusage" {
project = google_project.project.project_id
service = "serviceusage.googleapis.com"
disable_on_destroy = false # Need it enabled in the project when the test disables services in post-test cleanup
}
`, context)
}

Expand Down Expand Up @@ -293,16 +300,6 @@ resource "google_pubsub_topic" "example-resource-in" {
// the PubSub API. This allows the second apply step to succeed in a test, if needed.
func testAccSdkProvider_billing_project_useBillingProject_setupWithApiEnabled(context map[string]interface{}) string {
return testAccSdkProvider_billing_project_useBillingProject_setup(context) + acctest.Nprintf(`
# Needed for post test cleanup
resource "google_project_service" "serviceusage" {
project = google_project.project.project_id
service = "serviceusage.googleapis.com"
depends_on = [
google_project_service.pubsub,
google_project_service.cloudresourcemanager
]
}
# Needed for test steps to apply without error
resource "google_project_service" "pubsub" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ data "google_provider_config_sdk" "default" {}
// - If user_project_override = false : the apply fails as the API is disabled in project-1
// - If user_project_override = true : the apply succeeds as X-Goog-User-Project will reference project-2, where API is enabled
func testAccProviderUserProjectOverride(t *testing.T) {
// Parallel fine-grained resource creation
// Test cannot run in VCR mode due to use of aliases
// See: https://github.com/hashicorp/terraform-provider-google/issues/20019
// And also due to the resources made out of band in acctest.SetupProjectsAndGetAccessToken
acctest.SkipIfVcr(t)
t.Parallel()

Expand Down Expand Up @@ -286,7 +288,9 @@ func testAccProviderUserProjectOverride(t *testing.T) {
// Do the same thing as TestAccProviderUserProjectOverride, but using a resource that gets its project via
// a reference to a different resource instead of a project field.
func testAccProviderIndirectUserProjectOverride(t *testing.T) {
// Parallel fine-grained resource creation
// Test cannot run in VCR mode due to use of aliases
// See: https://github.com/hashicorp/terraform-provider-google/issues/20019
// And also due to the resources made out of band in acctest.SetupProjectsAndGetAccessToken
acctest.SkipIfVcr(t)
t.Parallel()

Expand Down

0 comments on commit ca3f2ed

Please sign in to comment.