Skip to content

Commit

Permalink
Simplify ValidateClusterSize() to use cmd.Output() directly
Browse files Browse the repository at this point in the history
This is a first step towards getting rid of finishRunningWithOutputs and
using the native os/exec methods directly where possible.
  • Loading branch information
filbranden committed Feb 11, 2015
1 parent aef5c34 commit 43543fa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hack/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,16 @@ func Up() bool {
// Ensure that the cluster is large engough to run the e2e tests.
func ValidateClusterSize() {
// Check that there are at least 3 minions running
res, stdout, _ := finishRunningWithOutputs("validate cluster size", exec.Command(path.Join(*root, "hack/e2e-internal/e2e-cluster-size.sh")))
if !res {
log.Fatal("Could not get nodes to validate cluster size")
cmd := exec.Command(path.Join(*root, "hack/e2e-internal/e2e-cluster-size.sh"))
if *verbose {
cmd.Stderr = os.Stderr
}
stdout, err := cmd.Output()
if err != nil {
log.Fatal("Could not get nodes to validate cluster size (%s)", err)
}

numNodes, err := strconv.Atoi(strings.TrimSpace(stdout))
numNodes, err := strconv.Atoi(strings.TrimSpace(string(stdout)))
if err != nil {
log.Fatalf("Could not count number of nodes to validate cluster size (%s)", err)
}
Expand Down

0 comments on commit 43543fa

Please sign in to comment.