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 8fa96d6 commit d0d00ae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 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: 9 additions & 9 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,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 d0d00ae

Please sign in to comment.