Skip to content

Print cluster hash for GKE k8s integration tests #2102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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