refine test cases according to spec

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
pull/14978/head
Jeanette Tan 5 months ago committed by György Krajcsovits
parent de9de320a4
commit 050b5fc257

@ -3760,27 +3760,27 @@ metric: <
} {
var expectedClassicHistCount, expectedNativeHistCount int
var expectCustomBuckets bool
switch {
case tc.scrapeClassicHistograms && tc.convertClassicHistograms:
expectedClassicHistCount = 1
expectedNativeHistCount = 1
expectCustomBuckets = true
case !tc.scrapeClassicHistograms && tc.convertClassicHistograms:
expectedClassicHistCount = 0
expectedNativeHistCount = 1
expectCustomBuckets = true
case tc.scrapeClassicHistograms && !tc.convertClassicHistograms:
expectedClassicHistCount = 1
expectedNativeHistCount = 0
case !tc.scrapeClassicHistograms && !tc.convertClassicHistograms:
expectedClassicHistCount = 1 // since these are sent without native histograms
expectedNativeHistCount = 0
}
if metricsText.hasExponential {
expectedNativeHistCount = 1
expectCustomBuckets = false
} else {
expectCustomBuckets = true
expectedClassicHistCount = 0
if metricsText.hasClassic && tc.scrapeClassicHistograms {
expectedClassicHistCount = 1
}
} else if metricsText.hasClassic {
switch {
case tc.scrapeClassicHistograms && tc.convertClassicHistograms:
expectedClassicHistCount = 1
expectedNativeHistCount = 1
expectCustomBuckets = true
case !tc.scrapeClassicHistograms && tc.convertClassicHistograms:
expectedClassicHistCount = 0
expectedNativeHistCount = 1
expectCustomBuckets = true
case !tc.convertClassicHistograms:
expectedClassicHistCount = 1
expectedNativeHistCount = 0
}
}
t.Run(fmt.Sprintf("%s with %s", name, metricsTextName), func(t *testing.T) {

Loading…
Cancel
Save