Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com>
  • Loading branch information
leonnicolas and bwplotka committed Feb 7, 2024
1 parent d4090e9 commit 6085d5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions prometheus/testutil/testutil.go
Expand Up @@ -255,16 +255,9 @@ func compareMetricFamilies(got, expected []*dto.MetricFamily, metricNames ...str
got = filterMetrics(got, metricNames)
expected = filterMetrics(expected, metricNames)
if len(metricNames) > len(got) {
h := make(map[string]struct{})
for _, mf := range got {
if mf == nil {
continue
}
h[mf.GetName()] = struct{}{}
}
var missingMetricNames []string
for _, name := range metricNames {
if _, ok := h[name]; !ok {
if _, ok := hasMetricByName(got,name); !ok {

Check failure on line 260 in prometheus/testutil/testutil.go

View workflow job for this annotation

GitHub Actions / lint

undefined: hasMetricByName) (typecheck)

Check failure on line 260 in prometheus/testutil/testutil.go

View workflow job for this annotation

GitHub Actions / lint

undefined: hasMetricByName

Check failure on line 260 in prometheus/testutil/testutil.go

View workflow job for this annotation

GitHub Actions / Tests (1.19)

undefined: hasMetricByName

Check failure on line 260 in prometheus/testutil/testutil.go

View workflow job for this annotation

GitHub Actions / Tests (1.19)

undefined: hasMetricByName

Check failure on line 260 in prometheus/testutil/testutil.go

View workflow job for this annotation

GitHub Actions / Tests (1.20)

undefined: hasMetricByName

Check failure on line 260 in prometheus/testutil/testutil.go

View workflow job for this annotation

GitHub Actions / Tests (1.20)

undefined: hasMetricByName
missingMetricNames = append(missingMetricNames, name)
}
}
Expand Down
4 changes: 2 additions & 2 deletions prometheus/testutil/testutil_test.go
Expand Up @@ -335,8 +335,8 @@ func TestScrapeAndCompare(t *testing.T) {
scenarios := map[string]struct {
want string
metricNames []string
errPrefix string
fail bool
// expectedErrPrefix if empty, means no fail is expected for the comparison.
expectedErrPrefix string
}{
"empty metric Names": {
want: `
Expand Down

0 comments on commit 6085d5d

Please sign in to comment.