(t *testing.T, conn *Conn)
| 547 | } |
| 548 | |
| 549 | func testConnReadWatermarkFromBatch(t *testing.T, conn *Conn) { |
| 550 | if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil { |
| 551 | t.Fatal(err) |
| 552 | } |
| 553 | |
| 554 | const minBytes = 1 |
| 555 | const maxBytes = 10e6 // 10 MB |
| 556 | |
| 557 | value := make([]byte, 10e3) // 10 KB |
| 558 | |
| 559 | batch := conn.ReadBatch(minBytes, maxBytes) |
| 560 | |
| 561 | for i := 0; i < 10; i++ { |
| 562 | _, err := batch.Read(value) |
| 563 | if err != nil { |
| 564 | if err = batch.Close(); err != nil { |
| 565 | t.Fatalf("error trying to read batch message: %s", err) |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | if batch.HighWaterMark() != 10 { |
| 570 | t.Fatal("expected highest offset (watermark) to be 10") |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | batch.Close() |
| 575 | } |
| 576 | |
| 577 | func testConnReadBatchWithNoMinMaxBytes(t *testing.T, conn *Conn) { |
| 578 | if _, err := conn.WriteMessages(makeTestSequence(10)...); err != nil { |
nothing calls this directly
no test coverage detected