(t *testing.T)
| 402 | } |
| 403 | |
| 404 | func TestValidateNativeHistogram(t *testing.T) { |
| 405 | userID := "fake" |
| 406 | lbls := cortexpb.FromLabelsToLabelAdapters(labels.FromStrings("foo", "bar")) |
| 407 | |
| 408 | // Test histogram has 4 positive buckets and 4 negative buckets so 8 in total. Schema set to 1. |
| 409 | h := tsdbutil.GenerateTestHistogram(0) |
| 410 | fh := tsdbutil.GenerateTestFloatHistogram(0) |
| 411 | |
| 412 | histogramWithSchemaMin := tsdbutil.GenerateTestHistogram(0) |
| 413 | histogramWithSchemaMin.Schema = histogram.ExponentialSchemaMin |
| 414 | floatHistogramWithSchemaMin := tsdbutil.GenerateTestFloatHistogram(0) |
| 415 | floatHistogramWithSchemaMin.Schema = histogram.ExponentialSchemaMin |
| 416 | |
| 417 | belowMinRangeSchemaHistogram := tsdbutil.GenerateTestFloatHistogram(0) |
| 418 | belowMinRangeSchemaHistogram.Schema = -5 |
| 419 | exceedMaxRangeSchemaFloatHistogram := tsdbutil.GenerateTestFloatHistogram(0) |
| 420 | exceedMaxRangeSchemaFloatHistogram.Schema = 20 |
| 421 | exceedMaxSampleSizeBytesLimitFloatHistogram := tsdbutil.GenerateTestFloatHistogram(100) |
| 422 | |
| 423 | bucketNumMisMatchInPSpanFH := tsdbutil.GenerateTestFloatHistogram(0) |
| 424 | bucketNumMisMatchInPSpanFH.PositiveSpans[0].Length = 3 |
| 425 | |
| 426 | negativeSpanOffsetInPSpansFH := tsdbutil.GenerateTestFloatHistogram(0) |
| 427 | negativeSpanOffsetInPSpansFH.PositiveSpans[1].Offset = -1 |
| 428 | |
| 429 | bucketNumMisMatchInNSpanFH := tsdbutil.GenerateTestFloatHistogram(0) |
| 430 | bucketNumMisMatchInNSpanFH.NegativeSpans[0].Length = 3 |
| 431 | |
| 432 | negativeSpanOffsetInNSpansFH := tsdbutil.GenerateTestFloatHistogram(0) |
| 433 | negativeSpanOffsetInNSpansFH.NegativeSpans[1].Offset = -1 |
| 434 | |
| 435 | negativeBucketCountInNBucketsFH := tsdbutil.GenerateTestFloatHistogram(0) |
| 436 | negativeBucketCountInNBucketsFH.NegativeBuckets = []float64{-1.1, -1.2, -1.3, -1.4} |
| 437 | |
| 438 | negativeBucketCountInPBucketsFH := tsdbutil.GenerateTestFloatHistogram(0) |
| 439 | negativeBucketCountInPBucketsFH.PositiveBuckets = []float64{-1.1, -1.2, -1.3, -1.4} |
| 440 | |
| 441 | negativeCountFloatHistogram := tsdbutil.GenerateTestFloatHistogram(0) |
| 442 | negativeCountFloatHistogram.Count = -1.2345 |
| 443 | |
| 444 | negativeZeroCountFloatHistogram := tsdbutil.GenerateTestFloatHistogram(0) |
| 445 | negativeZeroCountFloatHistogram.ZeroCount = -1.2345 |
| 446 | |
| 447 | bucketNumMisMatchInPSpanH := tsdbutil.GenerateTestHistogram(0) |
| 448 | bucketNumMisMatchInPSpanH.PositiveSpans[0].Length = 3 |
| 449 | |
| 450 | negativeSpanOffsetInPSpansH := tsdbutil.GenerateTestHistogram(0) |
| 451 | negativeSpanOffsetInPSpansH.PositiveSpans[1].Offset = -1 |
| 452 | |
| 453 | bucketNumMisMatchInNSpanH := tsdbutil.GenerateTestHistogram(0) |
| 454 | bucketNumMisMatchInNSpanH.NegativeSpans[0].Length = 3 |
| 455 | |
| 456 | negativeSpanOffsetInNSpansH := tsdbutil.GenerateTestHistogram(0) |
| 457 | negativeSpanOffsetInNSpansH.NegativeSpans[1].Offset = -1 |
| 458 | |
| 459 | negativeBucketCountInNBucketsH := tsdbutil.GenerateTestHistogram(0) |
| 460 | negativeBucketCountInNBucketsH.NegativeBuckets = []int64{-1, -2, -3, -4} |
| 461 |
nothing calls this directly
no test coverage detected