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

Function TestMergeTokens

pkg/ring/model_test.go:472–512  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

470}
471
472func TestMergeTokens(t *testing.T) {
473 tests := map[string]struct {
474 input [][]uint32
475 expected []uint32
476 }{
477 "empty input": {
478 input: nil,
479 expected: []uint32{},
480 },
481 "single instance in input": {
482 input: [][]uint32{
483 {1, 3, 4, 8},
484 },
485 expected: []uint32{1, 3, 4, 8},
486 },
487 "multiple instances in input": {
488 input: [][]uint32{
489 {1, 3, 4, 8},
490 {0, 2, 6, 9},
491 {5, 7, 10, 11},
492 },
493 expected: []uint32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
494 },
495 "some instances have no tokens": {
496 input: [][]uint32{
497 {1, 3, 4, 8},
498 {},
499 {0, 2, 6, 9},
500 {},
501 {5, 7, 10, 11},
502 },
503 expected: []uint32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11},
504 },
505 }
506
507 for testName, testData := range tests {
508 t.Run(testName, func(t *testing.T) {
509 assert.Equal(t, testData.expected, MergeTokens(testData.input))
510 })
511 }
512}
513
514func TestMergeTokensByZone(t *testing.T) {
515 tests := map[string]struct {

Callers

nothing calls this directly

Calls 3

MergeTokensFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected