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

Function TestWalBlockIterator

tempodb/encoding/vparquet4/wal_block_test.go:234–264  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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