Skip to content

Commit 478dfd6

Browse files
committed
add tests
1 parent 78a20f4 commit 478dfd6

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb

+45
Original file line numberDiff line numberDiff line change
@@ -3293,6 +3293,32 @@ func TestAccContainerCluster_withAutopilotKubeletConfig(t *testing.T) {
32933293
})
32943294
}
32953295

3296+
func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(t *testing.T) {
3297+
t.Parallel()
3298+
3299+
randomSuffix := acctest.RandString(t, 10)
3300+
clusterName := fmt.Sprintf("tf-test-cluster-%s", randomSuffix)
3301+
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
3302+
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
3303+
3304+
acctest.VcrTest(t, resource.TestCase{
3305+
PreCheck: func() { acctest.AccTestPreCheck(t) },
3306+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
3307+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
3308+
Steps: []resource.TestStep{
3309+
{
3310+
Config: testAccContainerCluster_withAutopilot_withNodePoolDefaults(clusterName, networkName, subnetworkName),
3311+
},
3312+
{
3313+
ResourceName: "google_container_cluster.primary",
3314+
ImportState: true,
3315+
ImportStateVerify: true,
3316+
ImportStateVerifyIgnore: []string{deletion_protection"},
3317+
},
3318+
},
3319+
})
3320+
}
3321+
32963322

32973323
func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) {
32983324
t.Parallel()
@@ -10594,6 +10620,25 @@ func testAccContainerCluster_withAutopilotKubeletConfigUpdates(name, insecureKub
1059410620
`, name, insecureKubeletReadonlyPortEnabled)
1059510621
}
1059610622

10623+
func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(name, networkName, subnetworkName string) string {
10624+
return fmt.Sprintf(`
10625+
resource "google_container_cluster" "primary" {
10626+
name = "%s"
10627+
location = "us-central1"
10628+
enable_autopilot = true
10629+
10630+
node_pool_defaults {
10631+
node_config_defaults {
10632+
}
10633+
}
10634+
10635+
deletion_protection = false
10636+
network = "%s"
10637+
subnetwork = "%s"
10638+
}
10639+
`, name, networkName, subnetworkName)
10640+
}
10641+
1059710642
func testAccContainerCluster_resourceManagerTags(projectID, clusterName, networkName, subnetworkName, randomSuffix string) string {
1059810643
return fmt.Sprintf(`
1059910644
data "google_project" "project" {

0 commit comments

Comments
 (0)