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

Function TestRowIterator

tempodb/encoding/vparquet4/wal_block_test.go:269–298  ·  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

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