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

Function TestRowIterator

tempodb/encoding/vparquet3/wal_block_test.go:266–295  ·  view source on GitHub ↗

TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator is internally consistent.

(t *testing.T)

Source from the content-addressed store, hash-verified

264// of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator
265// is internally consistent.
266func TestRowIterator(t *testing.T) {
267 testWalBlock(t, func(w *walBlock, _ []common.ID, _ []*tempopb.Trace) {
268 for _, f := range w.flushed {
269 ri, err := f.rowIterator(context.Background())
270 require.NoError(t, err)
271
272 var lastID []byte
273 for {
274 peekID, err := ri.peekNextID(context.Background())
275 require.NoError(t, err)
276
277 peekAgainID, err := ri.peekNextID(context.Background())
278 require.NoError(t, err)
279 require.Equal(t, peekID, peekAgainID)
280
281 id, _, err := ri.Next(context.Background())
282 require.NoError(t, err)
283 require.Equal(t, peekID, id)
284 if id == nil {
285 break
286 }
287
288 // make sure ordering is correct
289 require.True(t, bytes.Compare(lastID, id) < 0, "ids not in order: %v %v", lastID, id)
290
291 lastID = append([]byte(nil), id...)
292 }
293 }
294 })
295}
296
297func TestIteratorContextCancelled(t *testing.T) {
298 t.Run("already cancelled", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

testWalBlockFunction · 0.70
peekNextIDMethod · 0.65
NextMethod · 0.65
rowIteratorMethod · 0.45
EqualMethod · 0.45
CompareMethod · 0.45

Tested by

no test coverage detected