(t *testing.T, ctx context.Context, r *Reader)
| 230 | } |
| 231 | |
| 232 | func testReaderReadLag(t *testing.T, ctx context.Context, r *Reader) { |
| 233 | const N = 5 |
| 234 | prepareReader(t, ctx, r, makeTestSequence(N)...) |
| 235 | |
| 236 | if lag, err := r.ReadLag(ctx); err != nil { |
| 237 | t.Error(err) |
| 238 | } else if lag != N { |
| 239 | t.Errorf("the initial lag value is %d but was expected to be %d", lag, N) |
| 240 | } |
| 241 | |
| 242 | for i := 0; i != N; i++ { |
| 243 | r.ReadMessage(ctx) |
| 244 | expect := int64(N - (i + 1)) |
| 245 | |
| 246 | if lag, err := r.ReadLag(ctx); err != nil { |
| 247 | t.Error(err) |
| 248 | } else if lag != expect { |
| 249 | t.Errorf("the lag value at offset %d is %d but was expected to be %d", i, lag, expect) |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | func testReaderOutOfRangeGetsCanceled(t *testing.T, ctx context.Context, r *Reader) { |
| 255 | prepareReader(t, ctx, r, makeTestSequence(10)...) |
nothing calls this directly
no test coverage detected