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

Function TestLimiter_minNonZero

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

Source from the content-addressed store, hash-verified

672}
673
674func TestLimiter_minNonZero(t *testing.T) {
675 t.Parallel()
676
677 tests := map[string]struct {
678 first int
679 second int
680 expected int
681 }{
682 "both zero": {
683 first: 0,
684 second: 0,
685 expected: 0,
686 },
687 "first is zero": {
688 first: 0,
689 second: 1,
690 expected: 1,
691 },
692 "second is zero": {
693 first: 1,
694 second: 0,
695 expected: 1,
696 },
697 "both non zero, second > first": {
698 first: 1,
699 second: 2,
700 expected: 1,
701 },
702 "both non zero, first > second": {
703 first: 2,
704 second: 1,
705 expected: 1,
706 },
707 }
708
709 for testName, testData := range tests {
710
711 t.Run(testName, func(t *testing.T) {
712 assert.Equal(t, testData.expected, minNonZero(testData.first, testData.second))
713 })
714 }
715}
716
717type ringCountMock struct {
718 mock.Mock

Callers

nothing calls this directly

Calls 3

minNonZeroFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected