Simplify ValidateClusterSize() to use cmd.Output() directly

This is a first step towards getting rid of finishRunningWithOutputs and
using the native os/exec methods directly where possible.
This commit is contained in:
Filipe Brandenburger 2015-02-11 14:57:34 -08:00
parent aef5c3410d
commit 43543faaa7

View File

@ -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)
}