Check if cluster is up before e2e test without -up

Minor usability nuisance: If you run:
  go run hack/e2e.go -v -test
.. and you don't happen to have an up e2e cluster, it should fail
fast, rather than chugging through every test and having them fall
over.
This commit is contained in:
Zach Loafman 2014-12-07 15:29:30 -08:00
parent 3910b2d6e1
commit 3009c88865

View File

@ -70,7 +70,7 @@ func main() {
if *isup { if *isup {
status := 1 status := 1
if runBash("get status", `$KUBECFG -server_version`) { if IsUp() {
status = 0 status = 0
log.Printf("Cluster is UP") log.Printf("Cluster is UP")
} else { } else {
@ -130,12 +130,22 @@ func Up() bool {
return true return true
} }
// Is the e2e cluster up?
func IsUp() bool {
return runBash("get status", `$KUBECFG -server_version`)
}
func tryUp() bool { func tryUp() bool {
return runBash("up", path.Join(*root, "/cluster/kube-up.sh; test-setup;")) return runBash("up", path.Join(*root, "/cluster/kube-up.sh; test-setup;"))
} }
func Test() (failed, passed []string) { func Test() (failed, passed []string) {
defer runBashUntil("watchEvents", "$KUBECTL --watch-only get events")() defer runBashUntil("watchEvents", "$KUBECTL --watch-only get events")()
if !IsUp() {
log.Fatal("Testing requested, but e2e cluster not up!")
}
// run tests! // run tests!
dir, err := os.Open(filepath.Join(*root, "hack", "e2e-suite")) dir, err := os.Open(filepath.Join(*root, "hack", "e2e-suite"))
if err != nil { if err != nil {