Skip to content

Commit 6199ae3

Browse files
committed
Print cluster hash for GKE k8s integration tests
1 parent c0695cb commit 6199ae3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/k8s-integration/cluster.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,25 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int,
268268
}
269269
}
270270

271+
out, err := exec.Command("gcloud", "container", "clusters", "describe", *gkeTestClusterName, locationArg, locationVal)
272+
if err != nil {
273+
return fmt.Errorf("failed to list cluster: %v %s", err, out)
274+
}
275+
scanner := bufio.newScanner(strings.NewReader(out))
276+
printedHash := false
277+
for scanner.Scan() {
278+
line := scanner.Text()
279+
if strings.HasPrefix(line, "id: ") {
280+
klog.Infof("%s %s", *gkeTestClusterName, locationVal)
281+
klog.Infof("%s", line)
282+
printedHash = true
283+
break
284+
}
285+
}
286+
if !printedHash {
287+
return fmt.Errorf("failed to find cluster hash in cluster describe: %s", out)
288+
}
289+
271290
return nil
272291
}
273292

0 commit comments

Comments
 (0)