Skip to content

Commit

Permalink
Clean up NFR test result formatting
Browse files Browse the repository at this point in the history
Problem: Some results files added extra newlines, causing our formatter to fail. Also, error log files were way too large for feasible parsing.

Solution: Remove extra newlines, and only include error logs instead of full log files.
  • Loading branch information
sjberman committed Sep 3, 2024
1 parent 77114a2 commit 747a8c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion tests/suite/reconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,6 @@ const reconfigResultTemplate = `
{{- range .EventsBuckets }}
- {{ .Le }}ms: {{ .Val }}
{{- end }}
`

func writeReconfigResults(dest io.Writer, results reconfigTestResults) error {
Expand Down
16 changes: 8 additions & 8 deletions tests/suite/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ The logs are attached only if there are errors.
Expect(err).ToNot(HaveOccurred())

logLines := strings.Split(logs, "\n")
errors := 0
var errors []string

outer:
for _, line := range logLines {
Expand All @@ -198,22 +198,24 @@ The logs are attached only if there are errors.
}
for _, substr := range substrings {
if strings.Contains(line, substr) {
errors++
errors = append(errors, line)
continue outer
}
}
}

// attach full logs
if errors > 0 {
// attach error logs
if len(errors) > 0 {
f, err := os.Create(fileName)
Expect(err).ToNot(HaveOccurred())
defer f.Close()

_, err = io.WriteString(f, logs)
for _, e := range errors {
_, err = io.WriteString(f, e)
}
Expect(err).ToNot(HaveOccurred())
}
return errors
return len(errors)
}

runTestWithMetricsAndLogs := func(testName, testResultsDir string, test func()) {
Expand Down Expand Up @@ -797,8 +799,6 @@ var _ = Describe("Zero downtime scale test", Ordered, Label("nfr", "zero-downtim
})

AfterAll(func() {
_, err := fmt.Fprintln(outFile)
Expect(err).ToNot(HaveOccurred())
Expect(outFile.Close()).To(Succeed())

// restoring NGF shared among tests in the suite
Expand Down

0 comments on commit 747a8c8

Please sign in to comment.