(t *testing.T)
| 524 | } |
| 525 | |
| 526 | func TestBucketLimitAppender(t *testing.T) { |
| 527 | example := histogram.Histogram{ |
| 528 | Schema: 0, |
| 529 | Count: 21, |
| 530 | Sum: 33, |
| 531 | ZeroThreshold: 0.001, |
| 532 | ZeroCount: 3, |
| 533 | PositiveSpans: []histogram.Span{ |
| 534 | {Offset: 0, Length: 3}, |
| 535 | }, |
| 536 | PositiveBuckets: []int64{3, 0, 0}, |
| 537 | NegativeSpans: []histogram.Span{ |
| 538 | {Offset: 0, Length: 3}, |
| 539 | }, |
| 540 | NegativeBuckets: []int64{3, 0, 0}, |
| 541 | } |
| 542 | |
| 543 | bigGap := histogram.Histogram{ |
| 544 | Schema: 0, |
| 545 | Count: 21, |
| 546 | Sum: 33, |
| 547 | ZeroThreshold: 0.001, |
| 548 | ZeroCount: 3, |
| 549 | PositiveSpans: []histogram.Span{ |
| 550 | {Offset: 1, Length: 1}, // in (1, 2] |
| 551 | {Offset: 2, Length: 1}, // in (8, 16] |
| 552 | }, |
| 553 | PositiveBuckets: []int64{1, 0}, // 1, 1 |
| 554 | } |
| 555 | |
| 556 | customBuckets := histogram.Histogram{ |
| 557 | Schema: histogram.CustomBucketsSchema, |
| 558 | Count: 9, |
| 559 | Sum: 33, |
| 560 | PositiveSpans: []histogram.Span{ |
| 561 | {Offset: 0, Length: 3}, |
| 562 | }, |
| 563 | PositiveBuckets: []int64{3, 0, 0}, |
| 564 | CustomValues: []float64{1, 2, 3}, |
| 565 | } |
| 566 | |
| 567 | cases := []struct { |
| 568 | h histogram.Histogram |
| 569 | limit int |
| 570 | expectError bool |
| 571 | expectBucketCount int |
| 572 | expectSchema int32 |
| 573 | }{ |
| 574 | { |
| 575 | h: example, |
| 576 | limit: 3, |
| 577 | expectError: true, |
| 578 | }, |
| 579 | { |
| 580 | h: example, |
| 581 | limit: 4, |
| 582 | expectError: false, |
| 583 | expectBucketCount: 4, |
nothing calls this directly
no test coverage detected
searching dependent graphs…