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

Function TestMergeTokensByZone

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

Source from the content-addressed store, hash-verified

512}
513
514func TestMergeTokensByZone(t *testing.T) {
515 tests := map[string]struct {
516 input map[string][][]uint32
517 expected map[string][]uint32
518 }{
519 "empty input": {
520 input: nil,
521 expected: map[string][]uint32{},
522 },
523 "single zone": {
524 input: map[string][][]uint32{
525 "zone-1": {
526 {1, 3, 4, 8},
527 {2, 5, 6, 7},
528 },
529 },
530 expected: map[string][]uint32{
531 "zone-1": {1, 2, 3, 4, 5, 6, 7, 8},
532 },
533 },
534 "multiple zones": {
535 input: map[string][][]uint32{
536 "zone-1": {
537 {1, 3, 4, 8},
538 {2, 5, 6, 7},
539 },
540 "zone-2": {
541 {3, 5},
542 {2, 4},
543 },
544 },
545 expected: map[string][]uint32{
546 "zone-1": {1, 2, 3, 4, 5, 6, 7, 8},
547 "zone-2": {2, 3, 4, 5},
548 },
549 },
550 }
551
552 for testName, testData := range tests {
553 t.Run(testName, func(t *testing.T) {
554 assert.Equal(t, testData.expected, MergeTokensByZone(testData.input))
555 })
556 }
557}
558
559func TestDesc_SplitById_JoinIds(t *testing.T) {
560 tests := map[string]struct {

Callers

nothing calls this directly

Calls 3

MergeTokensByZoneFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected