(t *testing.T, conn *Conn)
| 575 | } |
| 576 | |
| 577 | func testConnReadBatchWithNoMinMaxBytes(t *testing.T, conn *Conn) { |
| 578 | if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil { |
| 579 | t.Fatal(err) |
| 580 | } |
| 581 | |
| 582 | value := make([]byte, 10e3) // 10 KB |
| 583 | |
| 584 | batch := conn.ReadBatchWith(ReadBatchConfig{}) |
| 585 | |
| 586 | for i := 0; i < 10; i++ { |
| 587 | _, err := batch.Read(value) |
| 588 | if err != nil { |
| 589 | if err = batch.Close(); err != nil { |
| 590 | t.Fatalf("error trying to read batch message: %s", err) |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | if batch.HighWaterMark() != 10 { |
| 595 | t.Fatal("expected highest offset (watermark) to be 10") |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | if err := batch.Close(); err != nil { |
| 600 | t.Fatalf("error trying to close batch: %s", err) |
| 601 | } |
| 602 | |
| 603 | if err := batch.Err(); err != nil { |
| 604 | t.Fatalf("broken batch: %s", err) |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | func testConnReadBatchWithMaxWait(t *testing.T, conn *Conn) { |
| 609 | if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil { |
nothing calls this directly
no test coverage detected