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

Fix Monitoring Test #6554

Merged
merged 3 commits into from
Sep 16, 2022
Merged
Changes from 2 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 @@ -990,7 +990,7 @@ func TestAccContainerCluster_withNodePoolDefaults(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_node_pool_defaults",
"node_pool_defaults.0.node_config_defaults.0.gcfs_config.#", "1"),
resource.TestCheckResourceAttr("google_container_cluster.with_node_pool_defaults",
resource.TestCheckResourceAttr("google_container_cluster.with_node_pool_defaults",
"node_pool_defaults.0.node_config_defaults.0.gcfs_config.0.enabled", "true"),
),
},
Expand Down Expand Up @@ -2287,12 +2287,13 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_basic(clusterName),
Config: testAccContainerCluster_basic_1_23_8(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigEnabled(clusterName),
Expand All @@ -2302,6 +2303,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigUpdated(clusterName),
Expand All @@ -2310,6 +2312,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigPrometheusUpdated(clusterName),
Expand All @@ -2318,15 +2321,17 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
// Back to basic settings to test setting Prometheus on its own
{
Config: testAccContainerCluster_basic(clusterName),
Config: testAccContainerCluster_basic_1_23_8(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
},
{
Config: testAccContainerCluster_withMonitoringConfigPrometheusOnly(clusterName),
Expand All @@ -2335,15 +2340,17 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
<% end -%>
{
Config: testAccContainerCluster_basic(clusterName),
Config: testAccContainerCluster_basic_1_23_8(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
},
})
Expand Down Expand Up @@ -6079,12 +6086,24 @@ resource "google_container_cluster" "primary" {
`, name)
}

func testAccContainerCluster_basic_1_23_8(name string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1
min_master_version = "1.23.8-gke.1900"
}
`, name)
}

func testAccContainerCluster_withMonitoringConfigEnabled(name string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1
min_master_version = "1.23.8-gke.1900"
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
monitoring_config {
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ]
}
Expand All @@ -6099,6 +6118,7 @@ resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1
min_master_version = "1.23.8-gke.1900"
monitoring_config {
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "WORKLOADS" ]
}
Expand All @@ -6112,6 +6132,7 @@ resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1
min_master_version = "1.23.8-gke.1900"
monitoring_config {
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "WORKLOADS" ]
managed_prometheus {
Expand All @@ -6128,6 +6149,7 @@ resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1
min_master_version = "1.23.8-gke.1900"
monitoring_config {
managed_prometheus {
enabled = true
Expand Down