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

Function TestRowIterator

tempodb/encoding/vparquet5/wal_block_test.go:268–297  ·  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

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