Skip to content

Commit

Permalink
Update TestAccContainerCluster_withNodeConfig to update more fields
Browse files Browse the repository at this point in the history
Adjust `TestAccContainerCluster_withNodeConfig` to do update tests for:
`node_config.0.disk_size_gb`
`node_config.0.disk_type`
`node_config.0.machine_type`
`node_config.0.tags`
`node_config.0.taint`

Also add `ConfigPlanChecks`
  • Loading branch information
wyardley committed Oct 19, 2024
1 parent 16934d1 commit 635fe1c
Showing 1 changed file with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1515,20 +1515,30 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withNodeConfig(clusterName, networkName, subnetworkName),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
acctest.ExpectNoDelete(),
},
},
},
{
ResourceName: "google_container_cluster.with_node_config",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_cluster.with_node_config",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"node_config.0.taint", "deletion_protection"},
},
{
Config: testAccContainerCluster_withNodeConfigUpdate(clusterName, networkName, subnetworkName),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
acctest.ExpectNoDelete(),
},
},
},
{
ResourceName: "google_container_cluster.with_node_config",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_cluster.with_node_config",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"node_config.0.taint", "deletion_protection"},
},
},
Expand Down Expand Up @@ -6981,9 +6991,11 @@ resource "google_container_cluster" "with_node_config" {
initial_node_count = 1

node_config {
machine_type = "n1-standard-1" // can't be e2 because of local-ssd
disk_size_gb = 15
disk_type = "pd-ssd"
// Test updates for these fields as well
machine_type = "n1-standard-2" // can't be e2 because of local-ssd
disk_size_gb = 20
disk_type = "pd-balanced"

local_ssd_count = 1
oauth_scopes = [
"https://www.googleapis.com/auth/monitoring",
Expand All @@ -6996,26 +7008,27 @@ resource "google_container_cluster" "with_node_config" {
foo = "bar"
disable-legacy-endpoints = "true"
}

labels = {
foo = "bar"
foo = "baz"
qux = "zzz"
}
tags = ["foo", "bar"]
tags = ["baz", "qux"]
preemptible = true
min_cpu_platform = "Intel Broadwell"

taint {
key = "taint_key"
value = "taint_value"
effect = "PREFER_NO_SCHEDULE"
effect = "NO_SCHEDULE"
}

taint {
key = "taint_key2"
value = "taint_value2"
value = "taint_value2_updated"
effect = "NO_EXECUTE"
}

// Updatable fields
image_type = "UBUNTU_CONTAINERD"
}
deletion_protection = false
Expand Down

0 comments on commit 635fe1c

Please sign in to comment.