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

Function testRetainWithConfig

tempodb/retention_test.go:274–362  ·  view source on GitHub ↗
(t *testing.T, targetBlockVersion string)

Source from the content-addressed store, hash-verified

272}
273
274func testRetainWithConfig(t *testing.T, targetBlockVersion string) {
275 tempDir := t.TempDir()
276
277 logger := log.NewLogfmtLogger(os.Stderr)
278
279 r, w, c, err := New(
280 &Config{
281 Backend: backend.Local,
282 Pool: &pool.Config{
283 MaxWorkers: 10,
284 QueueDepth: 100,
285 },
286 Local: &local.Config{
287 Path: path.Join(tempDir, "traces"),
288 },
289 Block: &common.BlockConfig{
290 BloomFP: .01,
291 BloomShardSizeBytes: 100_000,
292 Version: targetBlockVersion,
293 },
294 WAL: &wal.Config{
295 Filepath: path.Join(tempDir, "wal"),
296 },
297 BlocklistPoll: 100 * time.Millisecond,
298 }, nil,
299 // log.NewNopLogger()
300 logger,
301 )
302 require.NoError(t, err)
303
304 ctx, cancel := context.WithCancel(context.Background())
305 defer cancel()
306
307 r.EnablePolling(ctx, &mockJobSharder{}, false)
308
309 blocks := cutTestBlocks(t, w, testTenantID, 10, 10)
310
311 metas := make([]*backend.BlockMeta, 0)
312 for _, b := range blocks {
313 metas = append(metas, b.BlockMeta())
314 }
315
316 time.Sleep(time.Second)
317
318 compactorCfg := &CompactorConfig{
319 MaxCompactionRange: time.Hour,
320 BlockRetention: time.Nanosecond,
321 CompactedBlockRetention: time.Nanosecond,
322 MaxCompactionObjects: 1000,
323 MaxBlockBytes: 100_000_000, // Needs to be sized appropriately for the test data
324 RetentionConcurrency: 1,
325 }
326
327 var (
328 rw = r.(*readerWriter)
329 preM = rw.blocklist.Metas(testTenantID)
330 preCm = rw.blocklist.CompactedMetas(testTenantID)
331 )

Callers 1

TestRetainWithConfigFunction · 0.85

Calls 12

NewFunction · 0.70
cutTestBlocksFunction · 0.70
JoinMethod · 0.65
EnablePollingMethod · 0.65
BlockMetaMethod · 0.65
SleepMethod · 0.65
LenMethod · 0.65
CompactWithConfigMethod · 0.65
RetainWithConfigMethod · 0.65
MetasMethod · 0.45
CompactedMetasMethod · 0.45
LessMethod · 0.45

Tested by

no test coverage detected