Skip to content

Commit

Permalink
Fix TestAccContainerCluster_misc, add alpha cluster test (#5418)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: emily <emilyye@google.com>
  • Loading branch information
modular-magician and emilymye committed Jan 16, 2020
1 parent c901a1b commit b22f0e2
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,29 @@ func TestAccContainerCluster_withMasterAuthorizedNetworksDisabled(t *testing.T)
})
}

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

clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(10))
npName := fmt.Sprintf("tf-test-np-%s", acctest.RandString(10))

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withEnableKubernetesAlpha(clusterName, npName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccContainerCluster_masterAuthorizedNetworksDisabled(resource_name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[resource_name]
Expand Down Expand Up @@ -1340,7 +1363,6 @@ resource "google_container_cluster" "primary" {
"us-central1-c",
]
enable_kubernetes_alpha = true
enable_legacy_abac = true
logging_service = "logging.googleapis.com"
Expand Down Expand Up @@ -1372,7 +1394,6 @@ resource "google_container_cluster" "primary" {
"us-central1-c",
]
enable_kubernetes_alpha = true # Not updatable
enable_legacy_abac = false
logging_service = "none"
Expand Down Expand Up @@ -2589,3 +2610,22 @@ resource "google_container_cluster" "with_private_cluster" {
}
`, containerNetName, clusterName)
}

func testAccContainerCluster_withEnableKubernetesAlpha(cluster, np string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
enable_kubernetes_alpha = true
node_pool {
name = "%s"
initial_node_count = 1
management {
auto_repair = false
auto_upgrade = false
}
}
}
`, cluster, np)
}

0 comments on commit b22f0e2

Please sign in to comment.