Skip to content

Commit

Permalink
Removed testing of basic auth for clusters (#5020) (#9686)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jul 30, 2021
1 parent d0e438b commit a60ecf5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 152 deletions.
3 changes: 3 additions & 0 deletions .changelog/5020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
5 changes: 0 additions & 5 deletions google/data_source_google_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ resource "google_container_cluster" "kubes" {
name = "tf-test-cluster-%s"
location = "us-central1-a"
initial_node_count = 1
master_auth {
username = "mr.yoda"
password = "adoy.rm.123456789"
}
}
data "google_container_cluster" "kubes" {
Expand Down
147 changes: 0 additions & 147 deletions google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,89 +173,6 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
})
}

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

clusterName := fmt.Sprintf("tf-test-cluster-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withMasterAuth(clusterName),
},
{
ResourceName: "google_container_cluster.with_master_auth",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccContainerCluster_updateMasterAuth(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth", "master_auth.0.username", "mr.yoda.adoy.mr"),
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth", "master_auth.0.password", "adoy.rm.123456789.mr.yoda"),
),
},
{
ResourceName: "google_container_cluster.with_master_auth",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccContainerCluster_disableMasterAuth(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth", "master_auth.0.username", ""),
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth", "master_auth.0.password", ""),
),
},
{
ResourceName: "google_container_cluster.with_master_auth",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccContainerCluster_updateMasterAuth(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth", "master_auth.0.username", "mr.yoda.adoy.mr"),
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth", "master_auth.0.password", "adoy.rm.123456789.mr.yoda"),
),
},
{
ResourceName: "google_container_cluster.with_master_auth",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

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

clusterName := fmt.Sprintf("tf-test-cluster-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withMasterAuthNoCert(clusterName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_container_cluster.with_master_auth_no_cert", "master_auth.0.client_certificate", ""),
),
},
{
ResourceName: "google_container_cluster.with_master_auth_no_cert",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) {
t.Parallel()
clusterName := fmt.Sprintf("tf-test-cluster-%s", randString(t, 10))
Expand Down Expand Up @@ -2007,70 +1924,6 @@ resource "google_container_cluster" "primary" {
`, projectID, clusterName)
}

func testAccContainerCluster_withMasterAuth(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_master_auth" {
name = "%s"
location = "us-central1-a"
initial_node_count = 3
enable_shielded_nodes = false
master_auth {
username = "mr.yoda"
password = "adoy.rm.123456789"
}
}
`, clusterName)
}

func testAccContainerCluster_updateMasterAuth(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_master_auth" {
name = "%s"
location = "us-central1-a"
initial_node_count = 3
master_auth {
username = "mr.yoda.adoy.mr"
password = "adoy.rm.123456789.mr.yoda"
}
}
`, clusterName)
}

func testAccContainerCluster_disableMasterAuth(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_master_auth" {
name = "%s"
location = "us-central1-a"
initial_node_count = 3
master_auth {
username = ""
password = ""
}
}
`, clusterName)
}

func testAccContainerCluster_withMasterAuthNoCert(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_master_auth_no_cert" {
name = "%s"
location = "us-central1-a"
initial_node_count = 3
master_auth {
username = "mr.yoda"
password = "adoy.rm.123456789"
client_certificate_config {
issue_client_certificate = false
}
}
}
`, clusterName)
}

func testAccContainerCluster_withNetworkPolicyEnabled(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_network_policy_enabled" {
Expand Down

0 comments on commit a60ecf5

Please sign in to comment.