mirror of https://github.com/k3s-io/k3s
Merge pull request #3488 from pmorie/e2e
Make e2e -up recreate running clusters; remove kube-up retrypull/6/head
commit
fbd4722094
23
hack/e2e.go
23
hack/e2e.go
|
@ -180,17 +180,20 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func TearDown() {
|
||||
runBash("teardown", "test-teardown")
|
||||
func TearDown() bool {
|
||||
return runBash("teardown", "test-teardown")
|
||||
}
|
||||
|
||||
// Up brings an e2e cluster up, recreating it if one is already running.
|
||||
func Up() bool {
|
||||
if !tryUp() {
|
||||
log.Printf("kube-up failed; will tear down and retry. (Possibly your cluster was in some partially created state?)")
|
||||
TearDown()
|
||||
return tryUp()
|
||||
if IsUp() {
|
||||
log.Printf("e2e cluster already running; will teardown")
|
||||
if res := TearDown(); !res {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
return runBash("up", path.Join(versionRoot, "/cluster/kube-up.sh; test-setup;"))
|
||||
}
|
||||
|
||||
// Is the e2e cluster up?
|
||||
|
@ -198,10 +201,6 @@ func IsUp() bool {
|
|||
return runBash("get status", `$KUBECTL version`)
|
||||
}
|
||||
|
||||
func tryUp() bool {
|
||||
return runBash("up", path.Join(versionRoot, "/cluster/kube-up.sh; test-setup;"))
|
||||
}
|
||||
|
||||
// PrepareVersion makes sure that the specified release version is locally
|
||||
// available and ready to be used by kube-up or kube-push. Returns the director
|
||||
// path of the release.
|
||||
|
@ -545,7 +544,7 @@ set -o pipefail
|
|||
export KUBE_CONFIG_FILE="config-test.sh"
|
||||
|
||||
# TODO(jbeda): This will break on usage if there is a space in
|
||||
# ${KUBE_ROOT}. Covert to an array? Or an exported function?
|
||||
# ${KUBE_ROOT}. Convert to an array? Or an exported function?
|
||||
export KUBECFG="` + versionRoot + `/cluster/kubecfg.sh` + kubecfgArgs() + `"
|
||||
export KUBECTL="` + versionRoot + `/cluster/kubectl.sh` + kubectlArgs() + `"
|
||||
|
||||
|
|
Loading…
Reference in New Issue