Browse Source

Merge pull request #12894 from linasm/linasm/test-case-for-ValidateHistogram

Additional test case for ValidateHistogram
pull/12898/head
Björn Rabenstein 1 year ago committed by GitHub
parent
commit
0de7f39e6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      tsdb/head_test.go

10
tsdb/head_test.go

@ -4836,6 +4836,16 @@ func TestHistogramValidation(t *testing.T) {
"valid histogram": { "valid histogram": {
h: tsdbutil.GenerateTestHistograms(1)[0], h: tsdbutil.GenerateTestHistograms(1)[0],
}, },
"valid histogram that has its Count (4) higher than the actual total of buckets (2 + 1)": {
// This case is possible if NaN values (which do not fall into any bucket) are observed.
h: &histogram.Histogram{
ZeroCount: 2,
Count: 4,
Sum: math.NaN(),
PositiveSpans: []histogram.Span{{Offset: 0, Length: 1}},
PositiveBuckets: []int64{1},
},
},
"rejects histogram that has too few negative buckets": { "rejects histogram that has too few negative buckets": {
h: &histogram.Histogram{ h: &histogram.Histogram{
NegativeSpans: []histogram.Span{{Offset: 0, Length: 1}}, NegativeSpans: []histogram.Span{{Offset: 0, Length: 1}},

Loading…
Cancel
Save