Merge pull request #60290 from bskiba/fix-e2e

Automatic merge from submit-queue (batch tested with PRs 55637, 57461, 60268, 60290, 60210). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Autoscaler e2e - fix getting initial pool size

**What this PR does / why we need it**:
Fixes gcloud commands when getting initial pool size in e2e autoscaler tests. Adds logging to make test easier to debug.

**Release note**:

```
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-02-23 09:49:45 -08:00 committed by GitHub
commit 5c0000bcf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1290,7 +1290,6 @@ func waitTillAllNAPNodePoolsAreRemoved() error {
return err
}
// Returns size of the newly added node pool
func addNodePool(name string, machineType string, numNodes int) {
args := []string{"container", "node-pools", "create", name, "--quiet",
"--machine-type=" + machineType,
@ -1330,10 +1329,10 @@ func getPoolInitialSize(poolName string) int {
// get initial node count
args := []string{"container", "node-pools", "describe", poolName, "--quiet",
"--cluster=" + framework.TestContext.CloudConfig.Cluster,
"--format=\"value(initialNodeCount)\""}
"--format=value(initialNodeCount)"}
output, err := execCmd(getGcloudCommand(args)...).CombinedOutput()
glog.Infof("Node-pool initial size: %s", output)
framework.ExpectNoError(err)
framework.ExpectNoError(err, string(output))
fields := strings.Fields(string(output))
Expect(len(fields)).Should(Equal(1))
size, err := strconv.ParseInt(fields[0], 10, 64)
@ -1342,9 +1341,9 @@ func getPoolInitialSize(poolName string) int {
// get number of node pools
args = []string{"container", "node-pools", "describe", poolName, "--quiet",
"--cluster=" + framework.TestContext.CloudConfig.Cluster,
"--format=\"value(instanceGroupUrls)\""}
"--format=value(instanceGroupUrls)"}
output, err = execCmd(getGcloudCommand(args)...).CombinedOutput()
framework.ExpectNoError(err)
framework.ExpectNoError(err, string(output))
nodeGroupCount := len(strings.Split(string(output), ";"))
return int(size) * nodeGroupCount
}