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

Remove TestAccContainerCluster_failedCreation #9310

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5165,34 +5165,6 @@ func TestAccContainerCluster_withEnablePrivateEndpointToggle(t *testing.T) {
})
}

func TestAccContainerCluster_failedCreation(t *testing.T) {
// Test that in a scenario where the cluster fails to create, a subsequent apply will delete the resource.
// Skip this test for now as we don't have a good way to force cluster creation to fail. https://github.com/hashicorp/terraform-provider-google/issues/13711
t.Skip()
t.Parallel()

clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))

project := acctest.BootstrapProject(t, "tf-fail-cluster-", envvar.GetTestBillingAccountFromEnv(t), []string{"container.googleapis.com"})
acctest.RemoveContainerServiceAgentRoleFromContainerEngineRobot(t, project)

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_failedCreation(clusterName, project.ProjectId),
ExpectError: regexp.MustCompile("timeout while waiting for state to become 'DONE'"),
},
{
Config: testAccContainerCluster_failedCreation_update(clusterName, project.ProjectId),
ExpectError: regexp.MustCompile("Failed to create cluster"),
Check: testAccCheckContainerClusterDestroyProducer(t),
},
},
})
}

func testAccContainerCluster_withEnablePrivateEndpoint(clusterName string, flag string) string {

return fmt.Sprintf(`
Expand Down Expand Up @@ -8377,40 +8349,6 @@ resource "google_container_cluster" "with_tpu_config" {
}
<% end -%>

func testAccContainerCluster_failedCreation(cluster, project string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
project = "%s"
location = "us-central1-a"
initial_node_count = 1

workload_identity_config {
workload_pool = "%s.svc.id.goog"
}

timeouts {
create = "40s"
}
deletion_protection = false
}`, cluster, project, project)
}

func testAccContainerCluster_failedCreation_update(cluster, project string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
project = "%s"
location = "us-central1-a"
initial_node_count = 1

workload_identity_config {
workload_pool = "%s.svc.id.goog"
}
deletion_protection = false
}`, cluster, project, project)
}

<% unless version == 'ga' -%>
func testAccContainerCluster_withProtectConfig(name string) string {
return fmt.Sprintf(`
Expand Down Expand Up @@ -8773,4 +8711,4 @@ resource "google_container_cluster" "without_confidential_boot_disk" {
}
`, clusterName, npName)
}
<% end -%>
<% end -%>