Skip to content

Commit

Permalink
Clean up NFR test result formatting (#2505)
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 authored Sep 3, 2024
1 parent 81d4142 commit ef7a852
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nfr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
workflow_dispatch:
inputs:
test_label:
description: NFR test to run. Choose between performance, upgrade, scale, or all
description: NFR test to run. Choose between a specific test or all tests
required: true
default: all
type: choice
options: [performance, upgrade, scale, all]
options: [performance, upgrade, scale, zero-downtime-scale, reconfiguration, all]
version:
description: Version of NGF under test
required: true
Expand Down
3 changes: 1 addition & 2 deletions tests/suite/reconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

// Cluster node size must be greater than or equal to 4 for test to perform correctly.
var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("reconfiguration", "nfr"), func() {
var _ = Describe("Reconfiguration Performance Testing", Ordered, Label("nfr", "reconfiguration"), func() {
const (
// used for cleaning up resources
maxResourceCount = 150
Expand Down Expand Up @@ -627,7 +627,6 @@ const reconfigResultTemplate = `
{{- range .EventsBuckets }}
- {{ .Le }}ms: {{ .Val }}
{{- end }}
`

func writeReconfigResults(dest io.Writer, results reconfigTestResults) error {
Expand Down
18 changes: 10 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)
Expect(err).ToNot(HaveOccurred())
for _, e := range errors {
_, err = io.WriteString(f, fmt.Sprintf("%s\n", e))
Expect(err).ToNot(HaveOccurred())
}
}
return errors
return len(errors)
}

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

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

Expand Down

0 comments on commit ef7a852

Please sign in to comment.