Skip to content

Commit 93bebd8

Browse files
committed
add logging
1 parent 860b855 commit 93bebd8

File tree

9 files changed

+17
-13
lines changed

9 files changed

+17
-13
lines changed

test/integration/node_pool/node_pool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestNodePool(t *testing.T) {
6060
)
6161

6262
// Cluster (and listed node pools) Assertions
63-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{"pool-01", "pool-02", "pool-03", "pool-04", "pool-05"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
63+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{"pool-01", "pool-02", "pool-03", "pool-04", "pool-05"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6464

6565
// K8s Assertions
6666
assert.JSONEq(`[

test/integration/simple_regional_with_gateway_api/simple_regional_with_gateway_api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestSimpleRegionalWithGatewayAPI(t *testing.T) {
6060
)
6161

6262
// Cluster Assertions
63-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
63+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6464
})
6565
bpt.Test()
6666
}

test/integration/simple_regional_with_ipv6/simple_regional_with_ipv6_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestSimpleRegionalWithGatewayAPI(t *testing.T) {
6060
)
6161

6262
// Cluster Assertions
63-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
63+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6464
})
6565
bpt.Test()
6666
}

test/integration/stub_domains/stub_domains_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestStubDomains(t *testing.T) {
6363
)
6464

6565
// Cluster Assertions
66-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
66+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6767

6868
// K8s Assertions
6969
// CAI does not include k8s.io/ConfigMap

test/integration/stub_domains_private/stub_domains_private_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestStubDomainsPrivate(t *testing.T) {
6363
)
6464

6565
// Cluster Assertions
66-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
66+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6767

6868
// K8s Assertions
6969
// CAI does not include k8s.io/ConfigMap

test/integration/stub_domains_upstream_nameservers/stub_domains_upstream_nameservers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestStubDomainsUpstreamNameservers(t *testing.T) {
6363
)
6464

6565
// Cluster Assertions
66-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
66+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6767

6868
// K8s Assertions
6969
// CAI does not include k8s.io/ConfigMap

test/integration/testutils/utils.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022-2024 Google LLC
1+
// Copyright 2022-2025 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ func TGKEVerifyExemptResources(t *testing.T, b *tft.TFBlueprintTest, assert *ass
7676
}
7777

7878
// TGKEAssertGolden asserts a cluster and listed node pools against paths in golden image
79-
func TGKEAssertGolden(assert *assert.Assertions, golden *golden.GoldenFile, clusterJson *gjson.Result, nodePools []string, exemptClusterPaths []string) {
79+
func TGKEAssertGolden(t *testing.T, assert *assert.Assertions, golden *golden.GoldenFile, clusterJson *gjson.Result, nodePools []string, exemptClusterPaths []string) {
8080
// Retrieve golden paths
8181
clusterCheckPaths := utils.GetTerminalJSONPaths(golden.GetJSON())
8282

@@ -90,6 +90,7 @@ func TGKEAssertGolden(assert *assert.Assertions, golden *golden.GoldenFile, clus
9090
}
9191
return false
9292
})
93+
t.Logf("Found %d cluster paths to check", len(clusterCheckPaths))
9394

9495
// Cluster assertions
9596
golden.JSONPathEqs(assert, *clusterJson, clusterCheckPaths)
@@ -99,15 +100,18 @@ func TGKEAssertGolden(assert *assert.Assertions, golden *golden.GoldenFile, clus
99100
assert.Truef(clusterJson.Get(fmt.Sprintf("nodePools.#(name==%s).name", nodePool)).Exists(), "NodePool not found: %s", nodePool)
100101

101102
nodeCheckPaths := utils.GetTerminalJSONPaths(golden.GetJSON().Get(fmt.Sprintf("nodePools.#(name==%s)", nodePool)))
103+
t.Logf("Found %d node %q paths to check", len(nodeCheckPaths), nodePool)
102104

103105
syncGroup := new(errgroup.Group)
104106
syncGroup.SetLimit(24)
105-
for _, nodeCheckPath := range nodeCheckPaths {
106-
nodeCheckPath := nodeCheckPath
107+
for i, nodeCheckPath := range nodeCheckPaths {
108+
i, nodeCheckPath := i, nodeCheckPath // https://golang.org/doc/faq#closures_and_goroutines
109+
nodePool := nodePool
107110
syncGroup.Go(func() error {
111+
t.Logf("Checking path %d: %s", i, nodeCheckPath)
108112
gotData := golden.ApplySanitizers(clusterJson.Get(fmt.Sprintf("nodePools.#(name==%s)", nodePool)).Get(nodeCheckPath).String())
109113
gfData := golden.GetJSON().Get(fmt.Sprintf("nodePools.#(name==%s)", nodePool)).Get(nodeCheckPath).String()
110-
assert.Equalf(gfData, gotData, "For node %s path %q expected %q to match fixture %q", nodePool, nodeCheckPath, gotData, gfData)
114+
assert.Equalf(gfData, gotData, "For node %q path %q expected %q to match fixture %q", nodePool, nodeCheckPath, gotData, gfData)
111115
return nil
112116
})
113117
}

test/integration/upstream_nameservers/upstream_nameservers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestUpstreamNameservers(t *testing.T) {
6363
)
6464

6565
// Cluster Assertions
66-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
66+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6767

6868
// K8s Assertions
6969
// CAI does not include k8s.io/ConfigMap

test/integration/workload_metadata_config/workload_metadata_config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestWorkloadMetadataConfig(t *testing.T) {
6161
)
6262

6363
// Cluster Assertions
64-
testutils.TGKEAssertGolden(assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
64+
testutils.TGKEAssertGolden(t, assert, g, &cluster, []string{"default-pool"}, []string{"monitoringConfig.componentConfig.enableComponents"}) // TODO: enableComponents is UL
6565

6666
// IAM Assertions
6767
// CAI IAM data can be stale

0 commit comments

Comments
 (0)