(t *testing.T, ctx context.Context, r *Reader)
| 155 | } |
| 156 | |
| 157 | func testReaderSetRandomOffset(t *testing.T, ctx context.Context, r *Reader) { |
| 158 | const N = 10 |
| 159 | prepareReader(t, ctx, r, makeTestSequence(N)...) |
| 160 | |
| 161 | for i := 0; i != 2*N; i++ { |
| 162 | offset := rand.Intn(N) |
| 163 | r.SetOffset(int64(offset)) |
| 164 | m, err := r.ReadMessage(ctx) |
| 165 | if err != nil { |
| 166 | t.Error("seeking to offset", offset, "failed:", err) |
| 167 | return |
| 168 | } |
| 169 | v, _ := strconv.Atoi(string(m.Value)) |
| 170 | if v != offset { |
| 171 | t.Error("message at offset", offset, "has wrong value:", v) |
| 172 | return |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | func testReaderSetOffsetAt(t *testing.T, ctx context.Context, r *Reader) { |
| 178 | // We make 2 batches of messages here with a brief 2 second pause |
nothing calls this directly
no test coverage detected
searching dependent graphs…