Skip to content

Commit 23b7e52

Browse files
authored
E2E Summary Output Fix (#2751)
The serial e2e tests require pod restarts which causes the metrics to scrape two sets of results, which the summary generator did not allow. Now, the results from the new pod will be aggregated to the final set. Signed-off-by: Daniel Franz <dfranz@redhat.com>
1 parent b63979e commit 23b7e52

7 files changed

Lines changed: 8 additions & 36 deletions

File tree

internal/shared/util/test/utils.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/e2e/features_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"github.com/cucumber/godog/colors"
1111
"github.com/spf13/pflag"
1212

13-
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
1413
"github.com/operator-framework/operator-controller/test/e2e/steps"
14+
"github.com/operator-framework/operator-controller/test/internal/summary"
1515
)
1616

1717
var opts = godog.Options{
@@ -47,10 +47,9 @@ func TestMain(m *testing.M) {
4747
if path == "" {
4848
fmt.Println("Note: E2E_SUMMARY_OUTPUT is unset; skipping summary generation")
4949
} else {
50-
if err := testutil.PrintSummary(path); err != nil {
51-
// Fail the run if alerts are found
50+
if err := summary.PrintSummary(path); err != nil {
51+
// Alert but do not fail the run if alerts are found
5252
fmt.Printf("%v", err)
53-
os.Exit(1)
5453
}
5554
}
5655
return
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test
1+
package summary
22

33
import (
44
"context"
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test
1+
package summary
22

33
import (
44
"context"
@@ -80,8 +80,8 @@ func (s *githubSummary) PerformanceQuery(title, pod, query, yLabel string, scale
8080
matrix, ok := result.(model.Matrix)
8181
if !ok {
8282
return "", fmt.Errorf("typecast for metrics samples failed; aborting")
83-
} else if len(matrix) != 1 {
84-
return "", fmt.Errorf("expected 1 set of results; got: %d", len(matrix))
83+
} else if len(matrix) == 0 {
84+
return "", fmt.Errorf("expected 1 or more sets of results; got 0")
8585
}
8686
chart := xychart{
8787
Title: title,
@@ -92,10 +92,6 @@ func (s *githubSummary) PerformanceQuery(title, pod, query, yLabel string, scale
9292
formattedData := make([]string, 0)
9393
// matrix does not allow [] access, so we just do one iteration for the single result
9494
for _, metric := range matrix {
95-
if len(metric.Values) < 2 {
96-
// A graph with one data point means something with the collection was wrong
97-
return "", fmt.Errorf("expected at least two data points; got: %d", len(metric.Values))
98-
}
9995
for _, sample := range metric.Values {
10096
floatSample := float64(sample.Value) * scaler
10197
formattedData = append(formattedData, fmt.Sprintf("%f", floatSample))
@@ -160,7 +156,7 @@ func executeTemplate(templateFile string, obj any) (string, error) {
160156
if err != nil {
161157
return "", fmt.Errorf("failed to get working directory: %w", err)
162158
}
163-
tmpl, err := template.New(templateFile).ParseGlob(filepath.Join(wd, "../../internal/shared/util/test/templates", templateFile))
159+
tmpl, err := template.New(templateFile).ParseGlob(filepath.Join(wd, "../internal/summary/templates", templateFile))
164160
if err != nil {
165161
return "", err
166162
}
File renamed without changes.

internal/shared/util/test/templates/mermaid_chart.md.tmpl renamed to test/internal/summary/templates/mermaid_chart.md.tmpl

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)