Skip to content

Commit cf16272

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

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

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: 38 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,38 @@ func GetTestProjectFromSetup(t *testing.T, idx int) string {
3235
}
3336
return projectIDs[idx]
3437
}
38+
39+
var (
40+
verifySkipJSONPaths = []string{
41+
"status",
42+
"location",
43+
"locations",
44+
"privateClusterConfig.enablePrivateEndpoint",
45+
"privateClusterConfig.enablePrivateNodes",
46+
"addonsConfig.horizontalPodAutoscaling",
47+
"addonsConfig.httpLoadBalancing",
48+
"addonsConfig.kubernetesDashboard.disabled",
49+
"addonsConfig.networkPolicyConfig.disabled",
50+
"nodePools.name",
51+
"nodePools.initialNodeCount",
52+
"nodePools.autoscaling.enabled",
53+
"nodePools.autoscaling.minNodeCount",
54+
"nodePools.autoscaling.maxNodeCount",
55+
"nodePools.config.machineType",
56+
"nodePools.config.diskSizeGb",
57+
"nodePools.config.labels",
58+
"nodePools.config.tags",
59+
"nodePools.management.autoRepair",
60+
}
61+
)
62+
63+
func TGKEVerify(t *testing.T, b *tft.TFBlueprintTest, assert *assert.Assertions) {
64+
_, ps := b.PlanAndShow()
65+
for _, r := range ps.ResourceChangesMap {
66+
if slices.Contains(verifySkipJSONPaths, r.Address) {
67+
t.Logf("Skipping plan address: %s", r.Address)
68+
continue
69+
}
70+
assert.Equal(tfjson.Actions{tfjson.ActionNoop}, r.Change.Actions, "must be no-op: %s", r.Address)
71+
}
72+
}

0 commit comments

Comments
 (0)