(t *testing.T)
| 268 | } |
| 269 | |
| 270 | func TestManualPartitioner(t *testing.T) { |
| 271 | partitioner := NewManualPartitioner("mytopic") |
| 272 | |
| 273 | choice, err := partitioner.Partition(&ProducerMessage{}, 1) |
| 274 | if err != nil { |
| 275 | t.Error(partitioner, err) |
| 276 | } |
| 277 | if choice != 0 { |
| 278 | t.Error("Returned non-zero partition when only one available.") |
| 279 | } |
| 280 | |
| 281 | for i := int32(1); i < 50; i++ { |
| 282 | choice, err := partitioner.Partition(&ProducerMessage{Partition: i}, 50) |
| 283 | if err != nil { |
| 284 | t.Error(partitioner, err) |
| 285 | } |
| 286 | if choice != i { |
| 287 | t.Error("Returned partition not the same as the input partition") |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | func TestWithCustomFallbackPartitioner(t *testing.T) { |
| 293 | topic := "mytopic" |
nothing calls this directly
no test coverage detected