MCPcopy
hub / github.com/segmentio/kafka-go / testReaderLag

Function testReaderLag

reader_test.go:214–230  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, r *Reader)

Source from the content-addressed store, hash-verified

212}
213
214func testReaderLag(t *testing.T, ctx context.Context, r *Reader) {
215 const N = 5
216 prepareReader(t, ctx, r, makeTestSequence(N)...)
217
218 if lag := r.Lag(); lag != 0 {
219 t.Errorf("the initial lag value is %d but was expected to be 0", lag)
220 }
221
222 for i := 0; i != N; i++ {
223 r.ReadMessage(ctx)
224 expect := int64(N - (i + 1))
225
226 if lag := r.Lag(); lag != expect {
227 t.Errorf("the lag value at offset %d is %d but was expected to be %d", i, lag, expect)
228 }
229 }
230}
231
232func testReaderReadLag(t *testing.T, ctx context.Context, r *Reader) {
233 const N = 5

Callers

nothing calls this directly

Calls 4

prepareReaderFunction · 0.85
makeTestSequenceFunction · 0.85
LagMethod · 0.80
ReadMessageMethod · 0.45

Tested by

no test coverage detected