Skip to content

Commit a1902ed

Browse files
committed
chore(CI): add new verify
1 parent f67f416 commit a1902ed

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

examples/simple_autopilot_public/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ locals {
1818
cluster_type = "simple-autopilot-public"
1919
network_name = "simple-autopilot-public-network"
2020
subnet_name = "simple-autopilot-public-subnet"
21-
master_auth_subnetwork = "simple-autopilot-public-master-subnet"
2221
pods_range_name = "ip-range-pods-simple-autopilot-public"
2322
svc_range_name = "ip-range-svc-simple-autopilot-public"
2423
subnet_names = [for subnet_self_link in module.gcp-network.subnets_self_links : split("/", subnet_self_link)[length(split("/", subnet_self_link)) - 1]]
@@ -52,6 +51,7 @@ module "gke" {
5251
gcs_fuse_csi_driver = true
5352
stateful_ha = false
5453
gke_backup_agent_config = false
54+
enable_gcfs = true
5555
ray_operator_config = {
5656
enabled = true
5757
logging_enabled = true

examples/simple_autopilot_public/network.tf

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@ module "gcp-network" {
2323

2424
subnets = [
2525
{
26-
subnet_name = local.subnet_name
27-
subnet_ip = "10.0.0.0/17"
28-
subnet_region = var.region
29-
},
30-
{
31-
subnet_name = local.master_auth_subnetwork
32-
subnet_ip = "10.60.0.0/17"
33-
subnet_region = var.region
26+
subnet_name = local.subnet_name
27+
subnet_ip = "10.0.0.0/17"
28+
subnet_region = var.region
29+
subnet_private_access = true
3430
},
3531
]
3632

test/integration/simple_autopilot_public/simple_autopiliot_public_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
2323
"github.com/stretchr/testify/assert"
2424
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/testutils"
25+
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/utils"
2526
)
2627

2728
func TestSimpleAutopilotPublic(t *testing.T) {
@@ -32,6 +33,8 @@ func TestSimpleAutopilotPublic(t *testing.T) {
3233
bpt.DefineVerify(func(assert *assert.Assertions) {
3334
//Skipping Default Verify as the Verify Stage fails due to change in Client Cert Token
3435
// bpt.DefaultVerify(assert)
36+
utils.TGKEVerify(t, bpt, assert)
37+
bpt.DefaultVerify(assert)
3538

3639
projectId := bpt.GetStringOutput("project_id")
3740
location := bpt.GetStringOutput("location")

test/integration/utils/utils.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
package utils
1616

1717
import (
18+
"slices"
1819
"testing"
1920
"time"
2021

2122
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
23+
tfjson "github.com/hashicorp/terraform-json"
24+
"github.com/stretchr/testify/assert"
2225
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/testutils"
2326
)
2427

@@ -32,3 +35,19 @@ func GetTestProjectFromSetup(t *testing.T, idx int) string {
3235
}
3336
return projectIDs[idx]
3437
}
38+
39+
var (
40+
// TGKEVerify Exempt Resources. e.g. google_container_cluster.primary
41+
verifyExemptResources = []string{}
42+
)
43+
44+
func TGKEVerify(t *testing.T, b *tft.TFBlueprintTest, assert *assert.Assertions) {
45+
_, ps := b.PlanAndShow()
46+
for _, r := range ps.ResourceChangesMap {
47+
if slices.Contains(verifyExemptResources, r.Address) {
48+
t.Logf("Exempt plan address: %s", r.Address)
49+
continue
50+
}
51+
assert.Equal(tfjson.Actions{tfjson.ActionNoop}, r.Change.Actions, "plan must be no-op for resource: %s", r.Address)
52+
}
53+
}

0 commit comments

Comments
 (0)