Skip to content

Commit

Permalink
Fix Monitoring Test (#6554) (#4694)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Sep 16, 2022
1 parent 7402fa0 commit 7d58317
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .changelog/6554.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
70 changes: 46 additions & 24 deletions google-beta/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2266,61 +2266,68 @@ 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,
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigEnabled(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigUpdated(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigPrometheusUpdated(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
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,
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withMonitoringConfigPrometheusOnly(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_basic(clusterName),
Config: testAccContainerCluster_basic_1_23_8(clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
},
})
Expand Down Expand Up @@ -6019,12 +6026,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"
monitoring_config {
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ]
}
Expand All @@ -6038,6 +6057,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 @@ -6051,6 +6071,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 @@ -6067,6 +6088,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

0 comments on commit 7d58317

Please sign in to comment.