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

Function TestWalBlockIterator

tempodb/encoding/vparquet3/wal_block_test.go:233–261  ·  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
238 count := 0
239 for ; ; count++ {
240 id, tr, err := iter.Next(context.Background())
241 require.NoError(t, err)
242
243 if id == nil {
244 break
245 }
246
247 // Find trace in the input data
248 match := 0
249 for i := range ids {
250 if bytes.Equal(ids[i], id) {
251 match = i
252 break
253 }
254 }
255
256 require.Equal(t, ids[match], id)
257 require.True(t, proto.Equal(trs[match], tr))
258 }
259 require.Equal(t, len(ids), count)
260 })
261}
262
263// TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals
264// of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected