-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log dump when test failed #317
log dump when test failed #317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
tests/cmd/e2e/main.go
Outdated
@@ -53,9 +53,11 @@ func main() { | |||
LogLevel: "2", | |||
} | |||
if err := oa.CleanOperator(operatorInfo); err != nil { | |||
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{}) | |
oa.DumpAllLogs(operatorInfo, nil) |
tests/cmd/e2e/main.go
Outdated
glog.Fatal(err) | ||
} | ||
if err := oa.DeployOperator(operatorInfo); err != nil { | ||
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{}) | |
oa.DumpAllLogs(operatorInfo, nil) |
tests/log_dump.go
Outdated
if err != nil { | ||
writer.WriteString(err.Error()) | ||
} | ||
writer.WriteString(string(data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
might be nil, however it's unnecessary if you set writer as stdout & stderr.
81c31ed
to
d1038cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
|
||
func dumpPod(logPath string, pod *corev1.Pod) error { | ||
logFile, err := os.Create(filepath.Join(logPath, fmt.Sprintf("%s-%s.log", pod.Name, pod.Namespace))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log file name generate rule may resulting in the log generated during the second run will overwrite the first run
@xiaojingchen Please resolve the conflicts. |
* add log dump
@weekface @cwen0 @zyguan @shuijing198799 PTAL