add test case for bigGap

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
This commit is contained in:
Ziqi Zhao 2023-11-26 22:17:37 +08:00
parent 8fe9250f7d
commit 19ecc5dd94

View file

@ -507,6 +507,19 @@ func TestBucketLimitAppender(t *testing.T) {
NegativeBuckets: []int64{3, 0, 0}, NegativeBuckets: []int64{3, 0, 0},
} }
bigGap := histogram.Histogram{
Schema: 0,
Count: 21,
Sum: 33,
ZeroThreshold: 0.001,
ZeroCount: 3,
PositiveSpans: []histogram.Span{
{Offset: 1, Length: 1}, // in (1, 2]
{Offset: 2, Length: 1}, // in (8, 16]
},
PositiveBuckets: []int64{1, 0}, // 1, 1
}
cases := []struct { cases := []struct {
h histogram.Histogram h histogram.Histogram
limit int limit int
@ -533,6 +546,13 @@ func TestBucketLimitAppender(t *testing.T) {
expectBucketCount: 6, expectBucketCount: 6,
expectSchema: 0, expectSchema: 0,
}, },
{
h: bigGap,
limit: 1,
expectError: false,
expectBucketCount: 1,
expectSchema: -2,
},
} }
resApp := &collectResultAppender{} resApp := &collectResultAppender{}