Merge pull request #7484 from medyagh/post_mortem_logs

make post mortem logs easier on the eye
pull/7489/head
Medya Ghazizadeh 2020-04-07 12:40:56 -07:00 committed by GitHub
commit 6ba0e15e84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -201,34 +201,39 @@ func clusterLogs(t *testing.T, profile string) {
return
}
t.Logf("-----------------------post-mortem--------------------------------")
t.Logf("<<< %s FAILED: start of post-mortem logs <<<", t.Name())
t.Logf("-------------------post-mortem minikube logs----------------------")
rr, err := Run(t, exec.Command(Target(), "-p", profile, "logs", "--problems"))
if err != nil {
t.Logf("failed logs error: %v", err)
return
}
t.Logf("%s logs: %s", t.Name(), rr.Stdout)
t.Logf("%s logs: %s", t.Name(), rr.Output())
t.Logf("------------------post-mortem api server status-------------------")
st = Status(context.Background(), t, Target(), profile, "APIServer")
if st != state.Running.String() {
t.Logf("%q apiserver is not running, skipping kubectl commands (state=%q)", profile, st)
return
}
t.Logf("--------------------post-mortem get pods--------------------------")
rr, rerr := Run(t, exec.Command("kubectl", "--context", profile, "get", "po", "-A", "--show-labels"))
if rerr != nil {
t.Logf("%s: %v", rr.Command(), rerr)
return
}
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Stdout)
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Output())
t.Logf("-------------------post-mortem describe node----------------------")
rr, err = Run(t, exec.Command("kubectl", "--context", profile, "describe", "node"))
if err != nil {
t.Logf("%s: %v", rr.Command(), err)
} else {
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Stdout)
t.Logf("(dbg) %s:\n%s", rr.Command(), rr.Output())
}
t.Logf("------------------------------------------------------------------")
t.Logf("<<< %s FAILED: end of post-mortem logs <<<", t.Name())
t.Logf("---------------------/post-mortem---------------------------------")
}
// podStatusMsg returns a human-readable pod status, for generating debug status