Skip to content

Commit

Permalink
Remove TestAccContainerCluster_failedCreation (#9310) (#16314)
Browse files Browse the repository at this point in the history
[upstream:10e6993df58d414b6c03b3f414bae5798fa8df07]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Oct 19, 2023
1 parent 9095cd2 commit cfa2c60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 62 deletions.
2 changes: 2 additions & 0 deletions .changelog/9310.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```release-note:none
```
62 changes: 0 additions & 62 deletions google/services/container/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4487,34 +4487,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 @@ -7263,40 +7235,6 @@ resource "google_container_cluster" "primary" {
`, name, name, name)
}

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)
}

func testAccContainerCluster_autopilot_minimal(name string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
Expand Down

0 comments on commit cfa2c60

Please sign in to comment.