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

Function testWalBlock

tempodb/encoding/vparquet4/wal_block_test.go:457–489  ·  view source on GitHub ↗
(t *testing.T, f func(w *walBlock, ids []common.ID, trs []*tempopb.Trace))

Source from the content-addressed store, hash-verified

455}
456
457func testWalBlock(t *testing.T, f func(w *walBlock, ids []common.ID, trs []*tempopb.Trace)) {
458 meta := backend.NewBlockMeta("fake", uuid.New(), VersionString)
459 w, err := createWALBlock(meta, t.TempDir(), model.CurrentEncoding, 0)
460 require.NoError(t, err)
461
462 decoder := model.MustNewSegmentDecoder(model.CurrentEncoding)
463
464 count := 30
465 ids := make([]common.ID, count)
466 trs := make([]*tempopb.Trace, count)
467 for i := 0; i < count; i++ {
468 ids[i] = test.ValidTraceID(nil)
469 trs[i] = test.MakeTrace(10, ids[i])
470 trace.SortTrace(trs[i])
471
472 b1, err := decoder.PrepareForWrite(trs[i], 0, 0)
473 require.NoError(t, err)
474
475 b2, err := decoder.ToObject([][]byte{b1})
476 require.NoError(t, err)
477
478 err = w.Append(ids[i], b2, 0, 0, true)
479 require.NoError(t, err)
480
481 if i%10 == 0 {
482 require.NoError(t, w.Flush())
483 }
484 }
485
486 require.NoError(t, w.Flush())
487
488 f(w, ids, trs)
489}
490
491func TestCreateWALBlockFilterDedicatedColumns(t *testing.T) {
492 meta := backend.NewBlockMeta("fake", uuid.New(), VersionString)

Callers 4

TestWalBlockIteratorFunction · 0.70
TestRowIteratorFunction · 0.70

Calls 11

NewBlockMetaFunction · 0.92
MustNewSegmentDecoderFunction · 0.92
ValidTraceIDFunction · 0.92
MakeTraceFunction · 0.92
SortTraceFunction · 0.92
fFunction · 0.85
createWALBlockFunction · 0.70
PrepareForWriteMethod · 0.65
ToObjectMethod · 0.65
AppendMethod · 0.65
FlushMethod · 0.65

Tested by

no test coverage detected