(t *testing.T)
| 412 | } |
| 413 | |
| 414 | func TestMurmur2PartitionerConsistency(t *testing.T) { |
| 415 | partitioner := NewMurmur2Partitioner("mytopic") |
| 416 | ep, ok := partitioner.(DynamicConsistencyPartitioner) |
| 417 | if !ok { |
| 418 | t.Fatal("murmur2 partitioner does not implement DynamicConsistencyPartitioner") |
| 419 | } |
| 420 | |
| 421 | if !ep.MessageRequiresConsistency(&ProducerMessage{Key: StringEncoder("hi")}) { |
| 422 | t.Error("messages with keys should require consistency") |
| 423 | } |
| 424 | if ep.MessageRequiresConsistency(&ProducerMessage{}) { |
| 425 | t.Error("messages without keys should not require consistency") |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | // By default, Sarama uses the message's key to consistently assign a partition to |
| 430 | // a message using hashing. If no key is set, a random partition will be chosen. |
nothing calls this directly
no test coverage detected