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

Function TestWalBlockIterator

tempodb/encoding/vparquet5/wal_block_test.go:233–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

231}
232
233func TestWalBlockIterator(t *testing.T) {
234 testWalBlock(t, func(w *walBlock, ids []common.ID, trs []*tempopb.Trace) {
235 iter, err := w.Iterator(context.Background())
236 require.NoError(t, err)
237 defer iter.Close()
238
239 count := 0
240 for ; ; count++ {
241 id, tr, err := iter.Next(context.Background())
242 require.NoError(t, err)
243
244 if id == nil {
245 break
246 }
247
248 // Find trace in the input data
249 match := -1
250 for i := range ids {
251 if bytes.Equal(ids[i], id) {
252 match = i
253 break
254 }
255 }
256
257 require.NotEqual(t, -1, match, "iterator returned unexpected id")
258 require.Equal(t, ids[match], id)
259 require.True(t, proto.Equal(trs[match], tr))
260 }
261 require.Equal(t, len(ids), count)
262 })
263}
264
265// TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals
266// of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator

Callers

nothing calls this directly

Calls 5

testWalBlockFunction · 0.70
IteratorMethod · 0.65
CloseMethod · 0.65
NextMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected