Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions internal/shared/util/test/utils.go

This file was deleted.

7 changes: 3 additions & 4 deletions test/e2e/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/cucumber/godog/colors"
"github.com/spf13/pflag"

testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
"github.com/operator-framework/operator-controller/test/e2e/steps"
"github.com/operator-framework/operator-controller/test/internal/summary"
)

var opts = godog.Options{
Expand Down Expand Up @@ -47,10 +47,9 @@ func TestMain(m *testing.M) {
if path == "" {
fmt.Println("Note: E2E_SUMMARY_OUTPUT is unset; skipping summary generation")
} else {
if err := testutil.PrintSummary(path); err != nil {
// Fail the run if alerts are found
if err := summary.PrintSummary(path); err != nil {
// Alert but do not fail the run if alerts are found
fmt.Printf("%v", err)
os.Exit(1)
}
}
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test
package summary

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package test
package summary

import (
"context"
Expand Down Expand Up @@ -80,8 +80,8 @@ func (s *githubSummary) PerformanceQuery(title, pod, query, yLabel string, scale
matrix, ok := result.(model.Matrix)
if !ok {
return "", fmt.Errorf("typecast for metrics samples failed; aborting")
} else if len(matrix) != 1 {
return "", fmt.Errorf("expected 1 set of results; got: %d", len(matrix))
} else if len(matrix) == 0 {
return "", fmt.Errorf("expected 1 or more sets of results; got 0")
}
chart := xychart{
Title: title,
Expand All @@ -92,10 +92,6 @@ func (s *githubSummary) PerformanceQuery(title, pod, query, yLabel string, scale
formattedData := make([]string, 0)
// matrix does not allow [] access, so we just do one iteration for the single result
for _, metric := range matrix {
if len(metric.Values) < 2 {
// A graph with one data point means something with the collection was wrong
return "", fmt.Errorf("expected at least two data points; got: %d", len(metric.Values))
}
for _, sample := range metric.Values {
floatSample := float64(sample.Value) * scaler
formattedData = append(formattedData, fmt.Sprintf("%f", floatSample))
Expand Down Expand Up @@ -160,7 +156,7 @@ func executeTemplate(templateFile string, obj any) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to get working directory: %w", err)
}
tmpl, err := template.New(templateFile).ParseGlob(filepath.Join(wd, "../../internal/shared/util/test/templates", templateFile))
tmpl, err := template.New(templateFile).ParseGlob(filepath.Join(wd, "../internal/summary/templates", templateFile))
if err != nil {
return "", err
}
Expand Down
Loading