Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shuyama1 committed Sep 12, 2024
1 parent 78a20f4 commit 478dfd6
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3293,6 +3293,32 @@ func TestAccContainerCluster_withAutopilotKubeletConfig(t *testing.T) {
})
}

func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(t *testing.T) {
t.Parallel()

randomSuffix := acctest.RandString(t, 10)
clusterName := fmt.Sprintf("tf-test-cluster-%s", randomSuffix)
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withAutopilot_withNodePoolDefaults(clusterName, networkName, subnetworkName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{deletion_protection"},
},
},
})
}


func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -10594,6 +10620,25 @@ func testAccContainerCluster_withAutopilotKubeletConfigUpdates(name, insecureKub
`, name, insecureKubeletReadonlyPortEnabled)
}

func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(name, networkName, subnetworkName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1"
enable_autopilot = true

node_pool_defaults {
node_config_defaults {
}
}

deletion_protection = false
network = "%s"
subnetwork = "%s"
}
`, name, networkName, subnetworkName)
}

func testAccContainerCluster_resourceManagerTags(projectID, clusterName, networkName, subnetworkName, randomSuffix string) string {
return fmt.Sprintf(`
data "google_project" "project" {
Expand Down

0 comments on commit 478dfd6

Please sign in to comment.