Skip to content

Commit

Permalink
Test network policy config addon.
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-henderson committed Mar 15, 2018
1 parent 0e24782 commit 27e9672
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,16 @@ func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) {
),
},
{
Config: testAccContainerCluster_withNetworkPolicyDisabled(clusterName),
Config: testAccContainerCluster_withNetworkPolicyConfigDisabled(clusterName),
Check: resource.ComposeTestCheckFunc(
testAccCheckContainerCluster(
"google_container_cluster.with_network_policy_enabled"),
resource.TestCheckResourceAttr("google_container_cluster.with_network_policy_enabled",
"addons_config.0.network_policy_config.0.disabled", "true"),
),
},
{
Config: testAccContainerCluster_withNetworkPolicyConfigDisabled(clusterName),
PlanOnly: true,
ExpectNonEmptyPlan: false,
},
Expand Down Expand Up @@ -1121,6 +1130,11 @@ resource "google_container_cluster" "with_network_policy_enabled" {
enabled = true
provider = "CALICO"
}
addons_config {
network_policy_config {
disabled = false
}
}
}`, clusterName)
}

Expand All @@ -1144,6 +1158,22 @@ resource "google_container_cluster" "with_network_policy_enabled" {
}`, clusterName)
}

func testAccContainerCluster_withNetworkPolicyConfigDisabled(clusterName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_network_policy_enabled" {
name = "%s"
zone = "us-central1-a"
initial_node_count = 1
network_policy = {}
addons_config {
network_policy_config {
disabled = true
}
}
}`, clusterName)
}

func testAccContainerCluster_withMasterAuthorizedNetworksConfig(clusterName string, cidrs []string) string {

cidrBlocks := ""
Expand Down

0 comments on commit 27e9672

Please sign in to comment.