Skip to content

Commit

Permalink
Remove a few redundant GKE tests (#895)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and danawillow committed Jun 26, 2019
1 parent 628ea8c commit 0ca0e71
Showing 1 changed file with 19 additions and 170 deletions.
189 changes: 19 additions & 170 deletions google-beta/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,6 @@ func TestAccContainerCluster_basic(t *testing.T) {
})
}

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

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withTimeout(),
},
{
ResourceName: "google_container_cluster.primary",
ImportStateIdPrefix: "us-central1-a/",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

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

Expand All @@ -139,10 +118,6 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withAddons(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.http_load_balancing.0.disabled", "true"),
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.kubernetes_dashboard.0.disabled", "true"),
),
},
{
ResourceName: "google_container_cluster.primary",
Expand All @@ -152,11 +127,6 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
},
{
Config: testAccContainerCluster_updateAddons(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.horizontal_pod_autoscaling.0.disabled", "true"),
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.http_load_balancing.0.disabled", "false"),
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.kubernetes_dashboard.0.disabled", "true"),
),
},
{
ResourceName: "google_container_cluster.primary",
Expand Down Expand Up @@ -254,68 +224,6 @@ func TestAccContainerCluster_withMasterAuthConfig_NoCert(t *testing.T) {
})
}

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

clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withIstioEnabled(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_istio_enabled", "addons_config.0.istio_config.0.disabled", "false"),
),
},
{
ResourceName: "google_container_cluster.with_istio_enabled",
ImportStateIdPrefix: "us-central1-a/",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccContainerCluster_withIstioAuthEnabled(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_istio_enabled", "addons_config.0.istio_config.0.auth", "AUTH_MUTUAL_TLS"),
),
},
{
ResourceName: "google_container_cluster.with_istio_enabled",
ImportStateIdPrefix: "us-central1-a/",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

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

clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withCloudRunEnabled(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_cloudrun_enabled", "addons_config.0.cloudrun_config.0.disabled", "false"),
),
},
{
ResourceName: "google_container_cluster.with_cloudrun_enabled",
ImportStateIdPrefix: "us-central1-a/",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) {
t.Parallel()
clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10))
Expand Down Expand Up @@ -2031,35 +1939,23 @@ resource "google_container_cluster" "primary" {
}`, name)
}

func testAccContainerCluster_withTimeout() string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "cluster-test-%s"
zone = "us-central1-a"
initial_node_count = 3
ip_allocation_policy {
use_ip_aliases = false
}
timeouts {
create = "30m"
delete = "30m"
update = "30m"
}
}`, acctest.RandString(10))
}

func testAccContainerCluster_withAddons(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
zone = "us-central1-a"
initial_node_count = 3
location = "us-central1-a"
initial_node_count = 1
addons_config {
http_load_balancing { disabled = true }
horizontal_pod_autoscaling { disabled = true }
kubernetes_dashboard { disabled = true }
network_policy_config { disabled = true }
istio_config {
disabled = true
auth = "AUTH_MUTUAL_TLS"
}
cloudrun_config { disabled = true }
}
}`, clusterName)
}
Expand All @@ -2068,13 +1964,19 @@ func testAccContainerCluster_updateAddons(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
zone = "us-central1-a"
initial_node_count = 3
location = "us-central1-a"
initial_node_count = 1
addons_config {
http_load_balancing { disabled = false }
kubernetes_dashboard { disabled = true }
horizontal_pod_autoscaling { disabled = true }
kubernetes_dashboard { disabled = false }
horizontal_pod_autoscaling { disabled = false }
network_policy_config { disabled = false }
istio_config {
disabled = false
auth = "AUTH_NONE"
}
cloudrun_config {disabled = false }
}
}`, clusterName)
}
Expand Down Expand Up @@ -2199,59 +2101,6 @@ resource "google_container_cluster" "with_network_policy_enabled" {
}`, clusterName)
}

func testAccContainerCluster_withIstioEnabled(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_istio_enabled" {
name = "%s"
zone = "us-central1-a"
initial_node_count = 1
addons_config {
istio_config {
disabled = false
auth = "AUTH_NONE"
}
}
}`, clusterName)
}

func testAccContainerCluster_withIstioAuthEnabled(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_istio_enabled" {
name = "%s"
zone = "us-central1-a"
initial_node_count = 1
addons_config {
istio_config {
disabled = false
auth = "AUTH_MUTUAL_TLS"
}
}
}`, clusterName)
}

func testAccContainerCluster_withCloudRunEnabled(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_cloudrun_enabled" {
name = "%s"
zone = "us-central1-a"
initial_node_count = 1
addons_config {
http_load_balancing {
disabled = false
}
istio_config {
disabled = false
}
cloudrun_config {
disabled = false
}
}
}`, clusterName)
}

func testAccContainerCluster_withAuthenticatorGroupsConfig(clusterName string) string {
return fmt.Sprintf(`
resource "google_compute_network" "container_network" {
Expand Down

0 comments on commit 0ca0e71

Please sign in to comment.