15
15
package utils
16
16
17
17
import (
18
+ "slices"
18
19
"testing"
19
20
"time"
20
21
21
22
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
23
+ tfjson "github.com/hashicorp/terraform-json"
24
+ "github.com/stretchr/testify/assert"
22
25
"github.com/terraform-google-modules/terraform-google-kubernetes-engine/test/integration/testutils"
23
26
)
24
27
@@ -32,3 +35,38 @@ func GetTestProjectFromSetup(t *testing.T, idx int) string {
32
35
}
33
36
return projectIDs [idx ]
34
37
}
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