(t *testing.T)
| 75 | } |
| 76 | |
| 77 | func TestRoundRobinPartitioner(t *testing.T) { |
| 78 | partitioner := NewRoundRobinPartitioner("mytopic") |
| 79 | |
| 80 | choice, err := partitioner.Partition(nil, 1) |
| 81 | if err != nil { |
| 82 | t.Error(partitioner, err) |
| 83 | } |
| 84 | if choice != 0 { |
| 85 | t.Error("Returned non-zero partition when only one available.") |
| 86 | } |
| 87 | |
| 88 | var i int32 |
| 89 | for i = 1; i < 50; i++ { |
| 90 | choice, err := partitioner.Partition(nil, 7) |
| 91 | if err != nil { |
| 92 | t.Error(partitioner, err) |
| 93 | } |
| 94 | if choice != i%7 { |
| 95 | t.Error("Returned partition", choice, "expecting", i%7) |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func TestNewHashPartitionerWithHasher(t *testing.T) { |
| 101 | // use the current default hasher fnv.New32a() |
nothing calls this directly
no test coverage detected