(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestPartitionRingDesc_partitionByToken(t *testing.T) { |
| 31 | desc := &PartitionRingDesc{ |
| 32 | Partitions: map[int32]PartitionDesc{ |
| 33 | 1: {Tokens: []uint32{1, 5, 8}, State: PartitionActive, StateTimestamp: 10}, |
| 34 | 2: {Tokens: []uint32{3, 4, 9}, State: PartitionActive, StateTimestamp: 20}, |
| 35 | }, |
| 36 | Owners: map[string]OwnerDesc{ |
| 37 | "ingester-zone-a-0": {OwnedPartition: 1, State: OwnerActive, UpdatedTimestamp: 10}, |
| 38 | "ingester-zone-b-0": {OwnedPartition: 1, State: OwnerActive, UpdatedTimestamp: 15}, |
| 39 | }, |
| 40 | } |
| 41 | |
| 42 | assert.Equal(t, map[Token]int32{1: 1, 5: 1, 8: 1, 3: 2, 4: 2, 9: 2}, desc.partitionByToken()) |
| 43 | } |
| 44 | |
| 45 | func TestPartitionRingDesc_countPartitionsByState(t *testing.T) { |
| 46 | t.Run("empty ring should return all states with 0 partitions each", func(t *testing.T) { |
nothing calls this directly
no test coverage detected