(t *testing.T, targetBlockVersion string)
| 272 | } |
| 273 | |
| 274 | func 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 | ) |
no test coverage detected