MCPcopy
hub / github.com/grafana/tempo / TestSyncIteratorPropagatesErrors

Function TestSyncIteratorPropagatesErrors

pkg/parquetquery/iters_test.go:208–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func TestSyncIteratorPropagatesErrors(t *testing.T) {
209 type T struct{ A int }
210
211 rows := []T{}
212 count := 10_000
213 for i := 0; i < count; i++ {
214 rows = append(rows, T{i})
215 }
216
217 ctx, cancel := context.WithCancel(context.Background())
218
219 pf := createFileWith(t, ctx, rows)
220
221 iter := NewSyncIterator(ctx, pf.RowGroups(), 0)
222
223 _, err := iter.Next()
224 require.NoError(t, err)
225
226 cancel()
227
228 // iterate until we get an error and confirm it's because of the context cancellation
229 for {
230 _, err = iter.Next()
231 if err != nil {
232 break
233 }
234 }
235 require.ErrorContains(t, err, "context canceled")
236}
237
238func BenchmarkColumnIterator(b *testing.B) {
239 for _, tc := range iterTestCases {

Callers

nothing calls this directly

Calls 3

NextMethod · 0.95
createFileWithFunction · 0.85
NewSyncIteratorFunction · 0.85

Tested by

no test coverage detected