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

Function testWalBlock

tempodb/encoding/vparquet3/wal_block_test.go:455–487  ·  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

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