Skip to content
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

Merged
merged 6 commits into from
Mar 18, 2019

Conversation

xiaojingchen
Copy link
Contributor

@xiaojingchen xiaojingchen commented Mar 13, 2019

@xiaojingchen xiaojingchen changed the title [WIP]log dump when test failed log dump when test failed Mar 13, 2019
@tennix tennix added the test/stability stability tests label Mar 13, 2019
Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

@@ -53,9 +53,11 @@ func main() {
LogLevel: "2",
}
if err := oa.CleanOperator(operatorInfo); err != nil {
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{})
oa.DumpAllLogs(operatorInfo, nil)

glog.Fatal(err)
}
if err := oa.DeployOperator(operatorInfo); err != nil {
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
oa.DumpAllLogs(operatorInfo, []*tests.TidbClusterInfo{})
oa.DumpAllLogs(operatorInfo, nil)

tests/manifests/e2e.yaml Outdated Show resolved Hide resolved
tests/log_dump.go Show resolved Hide resolved
tests/log_dump.go Outdated Show resolved Hide resolved
if err != nil {
writer.WriteString(err.Error())
}
writer.WriteString(string(data))
Copy link
Contributor

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.

tests/log_dump.go Show resolved Hide resolved
@xiaojingchen xiaojingchen force-pushed the xiaojingchen/log-dump branch from 81c31ed to d1038cf Compare March 15, 2019 06:51
Copy link
Contributor

@zyguan zyguan left a 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)))
Copy link
Contributor

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

@weekface
Copy link
Contributor

@xiaojingchen Please resolve the conflicts.

@weekface weekface merged commit 06a3742 into pingcap:stability Mar 18, 2019
weekface pushed a commit to weekface/tidb-operator that referenced this pull request Mar 21, 2019
tennix pushed a commit that referenced this pull request Mar 21, 2019
yahonda pushed a commit that referenced this pull request Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test/stability stability tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants