(t *testing.T)
| 266 | } |
| 267 | |
| 268 | func testWriterRoundRobin1(t *testing.T) { |
| 269 | const topic = "test-writer-1" |
| 270 | createTopic(t, topic, 1) |
| 271 | defer deleteTopic(t, topic) |
| 272 | |
| 273 | offset, err := readOffset(topic, 0) |
| 274 | if err != nil { |
| 275 | t.Fatal(err) |
| 276 | } |
| 277 | |
| 278 | w := newTestWriter(WriterConfig{ |
| 279 | Topic: topic, |
| 280 | Balancer: &RoundRobin{}, |
| 281 | }) |
| 282 | defer w.Close() |
| 283 | |
| 284 | if err := w.WriteMessages(context.Background(), Message{ |
| 285 | Value: []byte("Hello World!"), |
| 286 | }); err != nil { |
| 287 | t.Error(err) |
| 288 | return |
| 289 | } |
| 290 | |
| 291 | msgs, err := readPartition(topic, 0, offset) |
| 292 | if err != nil { |
| 293 | t.Error("error reading partition", err) |
| 294 | return |
| 295 | } |
| 296 | |
| 297 | if len(msgs) != 1 { |
| 298 | t.Error("bad messages in partition", msgs) |
| 299 | return |
| 300 | } |
| 301 | |
| 302 | for _, m := range msgs { |
| 303 | if string(m.Value) != "Hello World!" { |
| 304 | t.Error("bad messages in partition", msgs) |
| 305 | break |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | func TestValidateWriter(t *testing.T) { |
| 311 | tests := []struct { |
nothing calls this directly
no test coverage detected