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

Function testCompactWithConfig

tempodb/compactor_test.go:783–830  ·  view source on GitHub ↗
(t *testing.T, targetBlockVersion string)

Source from the content-addressed store, hash-verified

781}
782
783func testCompactWithConfig(t *testing.T, targetBlockVersion string) {
784 tempDir := t.TempDir()
785
786 _, w, c, err := New(&Config{
787 Backend: backend.Local,
788 Pool: &pool.Config{
789 MaxWorkers: 10,
790 QueueDepth: 100,
791 },
792 Local: &local.Config{
793 Path: path.Join(tempDir, "traces"),
794 },
795 Block: &common.BlockConfig{
796 BloomFP: .01,
797 BloomShardSizeBytes: 100_000,
798 Version: targetBlockVersion,
799 },
800 WAL: &wal.Config{
801 Filepath: path.Join(tempDir, "wal"),
802 },
803 BlocklistPoll: 0,
804 }, nil, log.NewNopLogger())
805 require.NoError(t, err)
806
807 ctx := context.Background()
808
809 blocks := cutTestBlocks(t, w, testTenantID, 10, 10)
810 metas := make([]*backend.BlockMeta, 0)
811 for _, b := range blocks {
812 metas = append(metas, b.BlockMeta())
813 }
814
815 _, err = c.CompactWithConfig(
816 ctx,
817 metas,
818 testTenantID,
819 &CompactorConfig{
820 MaxCompactionRange: 24 * time.Hour,
821 BlockRetention: 0,
822 CompactedBlockRetention: 0,
823 MaxCompactionObjects: 1000,
824 MaxBlockBytes: 100_000_000, // Needs to be sized appropriately for the test data
825 },
826 &mockSharder{},
827 &mockOverrides{},
828 )
829 require.NoError(t, err)
830}
831
832type testData struct {
833 id common.ID

Callers 1

TestCompactWithConfigFunction · 0.85

Calls 5

NewFunction · 0.70
cutTestBlocksFunction · 0.70
JoinMethod · 0.65
BlockMetaMethod · 0.65
CompactWithConfigMethod · 0.65

Tested by

no test coverage detected