(b *testing.B)
| 153 | } |
| 154 | |
| 155 | func BenchmarkPartitionRing_ActivePartitionForKey(b *testing.B) { |
| 156 | const ( |
| 157 | numActivePartitions = 100 |
| 158 | numInactivePartitions = 10 |
| 159 | ) |
| 160 | |
| 161 | ring := createPartitionRingWithPartitions(DefaultPartitionRingOptions(), numActivePartitions, numInactivePartitions, 0) |
| 162 | r := rand.New(rand.NewSource(time.Now().UnixNano())) |
| 163 | |
| 164 | b.ResetTimer() |
| 165 | |
| 166 | for n := 0; n < b.N; n++ { |
| 167 | _, err := ring.ActivePartitionForKey(r.Uint32()) |
| 168 | if err != nil { |
| 169 | b.Fail() |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | func TestPartitionRing_ShuffleShard(t *testing.T) { |
| 175 | t.Run("should honor the shard size", func(t *testing.T) { |
nothing calls this directly
no test coverage detected