(tb testing.TB, dir string, head *Head)
| 626 | } |
| 627 | |
| 628 | func createBlockFromHead(tb testing.TB, dir string, head *Head) string { |
| 629 | compactor, err := NewLeveledCompactor(context.Background(), nil, promslog.NewNopLogger(), []int64{1000000}, nil, nil) |
| 630 | require.NoError(tb, err) |
| 631 | |
| 632 | require.NoError(tb, os.MkdirAll(dir, 0o777)) |
| 633 | |
| 634 | // Add +1 millisecond to block maxt because block intervals are half-open: [b.MinTime, b.MaxTime). |
| 635 | // Because of this block intervals are always +1 than the total samples it includes. |
| 636 | ulids, err := compactor.Write(dir, head, head.MinTime(), head.MaxTime()+1, nil) |
| 637 | require.NoError(tb, err) |
| 638 | require.Len(tb, ulids, 1) |
| 639 | return filepath.Join(dir, ulids[0].String()) |
| 640 | } |
| 641 | |
| 642 | func createBlockFromOOOHead(tb testing.TB, dir string, head *OOOCompactionHead) string { |
| 643 | compactor, err := NewLeveledCompactor(context.Background(), nil, promslog.NewNopLogger(), []int64{1000000}, nil, nil) |
no test coverage detected
searching dependent graphs…