Skip to content

Commit

Permalink
pkg/custom-provider: update expected test queries
Browse files Browse the repository at this point in the history
  • Loading branch information
abursavich committed Aug 13, 2024
1 parent 7d89537 commit 69ae2d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pkg/custom-provider/series_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ var _ = Describe("Series Registry", func() {
resourceNames: []string{"somepod1", "somepod2"},
metricSelector: labels.Everything(),

expectedQuery: "sum(container_some_usage{namespace=\"somens\",pod=~\"somepod1|somepod2\",container!=\"POD\"}) by (pod)",
expectedQuery: "sum(container_some_usage{namespace=\"somens\",pod=~\"somepod[12]\",container!=\"POD\"}) by (pod)",
},
{
title: "container metrics counter",
Expand All @@ -173,7 +173,7 @@ var _ = Describe("Series Registry", func() {
resourceNames: []string{"somepod1", "somepod2"},
metricSelector: labels.Everything(),

expectedQuery: "sum(rate(container_some_count_total{namespace=\"somens\",pod=~\"somepod1|somepod2\",container!=\"POD\"}[1m])) by (pod)",
expectedQuery: "sum(rate(container_some_count_total{namespace=\"somens\",pod=~\"somepod[12]\",container!=\"POD\"}[1m])) by (pod)",
},
{
title: "container metrics seconds counter",
Expand All @@ -182,7 +182,7 @@ var _ = Describe("Series Registry", func() {
resourceNames: []string{"somepod1", "somepod2"},
metricSelector: labels.Everything(),

expectedQuery: "sum(rate(container_some_time_seconds_total{namespace=\"somens\",pod=~\"somepod1|somepod2\",container!=\"POD\"}[1m])) by (pod)",
expectedQuery: "sum(rate(container_some_time_seconds_total{namespace=\"somens\",pod=~\"somepod[12]\",container!=\"POD\"}[1m])) by (pod)",
},
// namespaced metrics
{
Expand Down
6 changes: 0 additions & 6 deletions pkg/naming/metrics_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,6 @@ func compactRegexp(values []string) (string, error) {
return "", ErrMalformedQuery
}
}
if len(values) == 0 {
return "", nil
}
if len(values) == 1 {
return values[0], nil
}
expr := strings.Join(values, "|")
re, err := syntax.Parse(expr, syntax.POSIX)
if err != nil {
Expand Down

0 comments on commit 69ae2d1

Please sign in to comment.