MCPcopy
hub / github.com/IBM/sarama / TestHashPartitionerMinInt32

Function TestHashPartitionerMinInt32

partitioner_test.go:197–212  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

195}
196
197func TestHashPartitionerMinInt32(t *testing.T) {
198 partitioner := NewHashPartitioner("mytopic")
199
200 msg := ProducerMessage{}
201 // "1468509572224" generates 2147483648 (uint32) result from Sum32 function
202 // which is -2147483648 or int32's min value
203 msg.Key = StringEncoder("1468509572224")
204
205 choice, err := partitioner.Partition(&msg, 50)
206 if err != nil {
207 t.Error(partitioner, err)
208 }
209 if choice < 0 || choice >= 50 {
210 t.Error("Returned partition", choice, "outside of range for nil key.")
211 }
212}
213
214func TestConsistentCRCHashPartitioner(t *testing.T) {
215 numPartitions := int32(100)

Callers

nothing calls this directly

Calls 4

NewHashPartitionerFunction · 0.85
StringEncoderTypeAlias · 0.85
PartitionMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected