MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestLimiter_AssertMaxSeriesPerLabelSet

Function TestLimiter_AssertMaxSeriesPerLabelSet

pkg/ingester/limiter_test.go:493–573  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

491}
492
493func TestLimiter_AssertMaxSeriesPerLabelSet(t *testing.T) {
494
495 tests := map[string]struct {
496 limits validation.Limits
497 expected error
498 ringReplicationFactor int
499 ringIngesterCount int
500 shardByAllLabels bool
501 series int
502 }{
503 "both local and global limit are disabled": {
504 ringReplicationFactor: 3,
505 ringIngesterCount: 10,
506 series: 200,
507 shardByAllLabels: true,
508 limits: validation.Limits{
509 LimitsPerLabelSet: []validation.LimitsPerLabelSet{
510 {
511 LabelSet: labels.FromMap(map[string]string{"foo": "bar"}),
512 Limits: validation.LimitsPerLabelSetEntry{
513 MaxSeries: 0,
514 },
515 },
516 },
517 },
518 },
519 "current number of series is above the limit": {
520 ringReplicationFactor: 3,
521 ringIngesterCount: 10,
522 series: 200,
523 shardByAllLabels: true,
524 expected: errMaxSeriesPerLabelSetLimitExceeded{globalLimit: 10, actualLocalLimit: 3},
525 limits: validation.Limits{
526 LimitsPerLabelSet: []validation.LimitsPerLabelSet{
527 {
528 LabelSet: labels.FromMap(map[string]string{"foo": "bar"}),
529 Limits: validation.LimitsPerLabelSetEntry{
530 MaxSeries: 10,
531 },
532 },
533 },
534 },
535 },
536 "current number of series is below the limit and shard by all labels": {
537 ringReplicationFactor: 3,
538 ringIngesterCount: 10,
539 series: 2,
540 shardByAllLabels: true,
541 limits: validation.Limits{
542 LimitsPerLabelSet: []validation.LimitsPerLabelSet{
543 {
544 LabelSet: labels.FromMap(map[string]string{"foo": "bar"}),
545 Limits: validation.LimitsPerLabelSetEntry{
546 MaxSeries: 10,
547 },
548 },
549 },
550 },

Callers

nothing calls this directly

Calls 5

NewOverridesFunction · 0.92
NewLimiterFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected