Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions test/k8s-integration/cluster.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"bufio"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -268,6 +269,26 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int,
}
}

cmd = exec.Command("gcloud", "container", "clusters", "describe", *gkeTestClusterName, locationArg, locationVal)
out, err = cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("failed to list cluster: %v %s", err, out)
}
scanner := bufio.NewScanner(strings.NewReader(string(out)))
printedHash := false
for scanner.Scan() {
line := scanner.Text()
if strings.HasPrefix(line, "id: ") {
klog.Infof("GKE cluster: %s %s", *gkeTestClusterName, locationVal)
klog.Infof("GKE cluster hash %s", line)
printedHash = true
break
}
}
if !printedHash {
return fmt.Errorf("failed to find cluster hash in cluster describe: %s", out)
}

return nil
}

Expand Down