mirror of https://github.com/k3s-io/k3s
Merge pull request #30405 from zmerlynn/dump-on-up-fail
Automatic merge from submit-queue hack/e2e.go: Make --dump run if --up fails, and if --down isn't specified See https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/kubernetes-e2e-aws/629 for why this would be useful. (And the requirement for --down is just unnecessary AFAICT.) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30405) <!-- Reviewable:end -->pull/6/head
commit
ff3bd05efb
14
hack/e2e.go
14
hack/e2e.go
|
@ -43,7 +43,7 @@ var (
|
|||
checkLeakedResources = flag.Bool("check_leaked_resources", false, "Ensure project ends with the same resources")
|
||||
ctlCmd = flag.String("ctl", "", "If nonempty, pass this as an argument, and call kubectl. Implies -v.")
|
||||
down = flag.Bool("down", false, "If true, tear down the cluster before exiting.")
|
||||
dump = flag.String("dump", "", "If set, dump cluster logs to this location")
|
||||
dump = flag.String("dump", "", "If set, dump cluster logs to this location on test or cluster-up failure")
|
||||
kubemark = flag.Bool("kubemark", false, "If true, run kubemark tests.")
|
||||
isup = flag.Bool("isup", false, "Check to see if the e2e cluster is up, then exit.")
|
||||
push = flag.Bool("push", false, "If true, push to e2e cluster. Has no effect if -up is true.")
|
||||
|
@ -127,10 +127,12 @@ func main() {
|
|||
}
|
||||
if *up {
|
||||
if !Up() {
|
||||
DumpClusterLogs(*dump)
|
||||
log.Fatal("Error starting e2e cluster. Aborting.")
|
||||
}
|
||||
} else if *push {
|
||||
if !finishRunning("push", exec.Command("./hack/e2e-internal/e2e-push.sh")) {
|
||||
DumpClusterLogs(*dump)
|
||||
log.Fatal("Error pushing e2e cluster. Aborting.")
|
||||
}
|
||||
}
|
||||
|
@ -170,10 +172,11 @@ func main() {
|
|||
success = success && kubeSuccess
|
||||
}
|
||||
|
||||
if !success {
|
||||
DumpClusterLogs(*dump)
|
||||
}
|
||||
|
||||
if *down {
|
||||
if !success && *dump != "" {
|
||||
DumpClusterLogs(*dump)
|
||||
}
|
||||
tearSuccess := TearDown()
|
||||
success = success && tearSuccess
|
||||
}
|
||||
|
@ -293,6 +296,9 @@ func IsUp() bool {
|
|||
}
|
||||
|
||||
func DumpClusterLogs(location string) {
|
||||
if location == "" {
|
||||
return
|
||||
}
|
||||
log.Printf("Dumping cluster logs to: %v", location)
|
||||
finishRunning("dump cluster logs", exec.Command("./cluster/log-dump.sh", location))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue