(ctx context.Context, t testing.TB, w tempodb.Writer, tenantCount, blockCount, recordCount int)
| 435 | } |
| 436 | |
| 437 | func populateBackend(ctx context.Context, t testing.TB, w tempodb.Writer, tenantCount, blockCount, recordCount int) []string { |
| 438 | wal := w.WAL() |
| 439 | |
| 440 | dec := model.MustNewSegmentDecoder(model.CurrentEncoding) |
| 441 | |
| 442 | tenants := make([]string, tenantCount) |
| 443 | |
| 444 | for i := range tenantCount { |
| 445 | tenantID := tenant + strconv.Itoa(i) |
| 446 | |
| 447 | tenants[i] = tenantID |
| 448 | |
| 449 | for range blockCount { |
| 450 | blockID := backend.NewUUID() |
| 451 | meta := &backend.BlockMeta{BlockID: blockID, TenantID: tenantID} |
| 452 | head, err := wal.NewBlock(meta, model.CurrentEncoding) |
| 453 | require.NoError(t, err) |
| 454 | |
| 455 | for range recordCount { |
| 456 | id := test.ValidTraceID(nil) |
| 457 | req := test.MakeTrace(10, id) |
| 458 | |
| 459 | writeTraceToWal(t, head, dec, id, req, 0, 0) |
| 460 | } |
| 461 | |
| 462 | _, err = w.CompleteBlock(ctx, head) |
| 463 | require.NoError(t, err) |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | return tenants |
| 468 | } |
| 469 | |
| 470 | func writeTraceToWal(t require.TestingT, b common.WALBlock, dec model.SegmentDecoder, id common.ID, tr *tempopb.Trace, start, end uint32) { |
| 471 | b1, err := dec.PrepareForWrite(tr, 0, 0) |
no test coverage detected