(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestRandomPartitioner(t *testing.T) { |
| 56 | partitioner := NewRandomPartitioner("mytopic") |
| 57 | |
| 58 | choice, err := partitioner.Partition(nil, 1) |
| 59 | if err != nil { |
| 60 | t.Error(partitioner, err) |
| 61 | } |
| 62 | if choice != 0 { |
| 63 | t.Error("Returned non-zero partition when only one available.") |
| 64 | } |
| 65 | |
| 66 | for i := 1; i < 50; i++ { |
| 67 | choice, err := partitioner.Partition(nil, 50) |
| 68 | if err != nil { |
| 69 | t.Error(partitioner, err) |
| 70 | } |
| 71 | if choice < 0 || choice >= 50 { |
| 72 | t.Error("Returned partition", choice, "outside of range.") |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func TestRoundRobinPartitioner(t *testing.T) { |
| 78 | partitioner := NewRoundRobinPartitioner("mytopic") |
nothing calls this directly
no test coverage detected