(t *testing.T)
| 129 | } |
| 130 | |
| 131 | func TestHashPartitionerWithHasherMinInt32(t *testing.T) { |
| 132 | // use the current default hasher fnv.New32a() |
| 133 | partitioner := NewCustomHashPartitioner(fnv.New32a)("mytopic") |
| 134 | |
| 135 | msg := ProducerMessage{} |
| 136 | // "1468509572224" generates 2147483648 (uint32) result from Sum32 function |
| 137 | // which is -2147483648 or int32's min value |
| 138 | msg.Key = StringEncoder("1468509572224") |
| 139 | |
| 140 | choice, err := partitioner.Partition(&msg, 50) |
| 141 | if err != nil { |
| 142 | t.Error(partitioner, err) |
| 143 | } |
| 144 | if choice < 0 || choice >= 50 { |
| 145 | t.Error("Returned partition", choice, "outside of range for nil key.") |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func TestHashPartitioner(t *testing.T) { |
| 150 | partitioner := NewHashPartitioner("mytopic") |
nothing calls this directly
no test coverage detected