Skip to content

Commit

Permalink
test improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien GLON committed Nov 2, 2017
1 parent f0e705f commit 1fb2e80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,14 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
},
}
}

if c.NetworkPolicyConfig != nil {
result["network_policy"] = []map[string]interface{}{
{
"disabled": c.NetworkPolicyConfig.Disabled,
},
}
}
return []map[string]interface{}{result}
}

Expand Down
6 changes: 4 additions & 2 deletions google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
"google_container_cluster.primary"),
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"),
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.network_policy.0.disabled", "false"),
),
},
{
Expand All @@ -82,6 +83,7 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
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"),
resource.TestCheckResourceAttr("google_container_cluster.primary", "addons_config.0.kubernetes_dashboard.0.disabled", "true"),
),
},
},
Expand Down Expand Up @@ -920,7 +922,7 @@ resource "google_container_cluster" "primary" {
addons_config {
http_load_balancing { disabled = true }
kubernetes_dashboard { disabled = true }
network_policy { disabled = true }
network_policy { disabled = false }
}
}`, clusterName)
}
Expand All @@ -936,7 +938,7 @@ resource "google_container_cluster" "primary" {
http_load_balancing { disabled = false }
kubernetes_dashboard { disabled = true }
horizontal_pod_autoscaling { disabled = true }
network_policy { disabled = false }
network_policy { disabled = true }
}
}`, clusterName)
}
Expand Down

0 comments on commit 1fb2e80

Please sign in to comment.