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

Function generateTestBlocks

cmd/tempo-cli/cmd-rewrite-blocks_test.go:64–89  ·  view source on GitHub ↗
(t *testing.T, tempDir string, tenantID string, blockCount int, traceCount int)

Source from the content-addressed store, hash-verified

62}
63
64func generateTestBlocks(t *testing.T, tempDir string, tenantID string, blockCount int, traceCount int) {
65 t.Helper()
66
67 rawR, rawW, _, err := local.New(&local.Config{
68 Path: tempDir,
69 })
70 require.NoError(t, err)
71
72 r := backend.NewReader(rawR)
73 w := backend.NewWriter(rawW)
74 ctx := context.Background()
75
76 cfg := &common.BlockConfig{
77 BloomFP: 0.01,
78 BloomShardSizeBytes: 100 * 1024,
79 }
80
81 for bn := 0; bn < blockCount; bn++ {
82 traces := newTestTraces(traceCount)
83 iter := &testIterator{traces: traces}
84 meta := backend.NewBlockMeta(tenantID, uuid.New(), vparquet4.VersionString)
85 meta.TotalObjects = int64(len(iter.traces))
86 _, err := vparquet4.CreateBlock(ctx, cfg, meta, iter, r, w)
87 require.NoError(t, err)
88 }
89}
90
91func getAllTraceIDs(t *testing.T, dir string, tenant string) []string {
92 t.Helper()

Callers 1

TestDropTraceCmdFunction · 0.85

Calls 6

NewFunction · 0.92
NewReaderFunction · 0.92
NewWriterFunction · 0.92
NewBlockMetaFunction · 0.92
CreateBlockFunction · 0.92
newTestTracesFunction · 0.85

Tested by

no test coverage detected