Skip to content

Commit

Permalink
Merge pull request #115515 from dgrisonnet/scrape-and-compare
Browse files Browse the repository at this point in the history
Add wrapper around ScrapeAndCompare
  • Loading branch information
k8s-ci-robot committed Feb 3, 2023
2 parents 1ded677 + c5774a7 commit 0e3818e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ func CustomCollectAndCompare(c metrics.StableCollector, expected io.Reader, metr
return GatherAndCompare(registry, expected, metricNames...)
}

// ScrapeAndCompare calls a remote exporter's endpoint which is expected to return some metrics in
// plain text format. Then it compares it with the results that the `expected` would return.
// If the `metricNames` is not empty it would filter the comparison only to the given metric names.
func ScrapeAndCompare(url string, expected io.Reader, metricNames ...string) error {
return testutil.ScrapeAndCompare(url, expected, metricNames...)
}

// NewFakeKubeRegistry creates a fake `KubeRegistry` that takes the input version as `build in version`.
// It should only be used in testing scenario especially for the deprecated metrics.
// The input version format should be `major.minor.patch`, e.g. '1.18.0'.
Expand Down

0 comments on commit 0e3818e

Please sign in to comment.