github.com/grafana/pyroscope@v1.18.0/pkg/phlaredb/block/metadata_test.go (about) 1 package block 2 3 import ( 4 "testing" 5 6 "github.com/oklog/ulid/v2" 7 "github.com/prometheus/common/model" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func TestClone(t *testing.T) { 12 require.Equal(t, &Meta{}, (&Meta{}).Clone()) 13 expected := &Meta{ 14 ULID: generateULID(), 15 MinTime: model.Time(1), 16 MaxTime: model.Time(2), 17 Labels: map[string]string{"a": "b"}, 18 Version: MetaVersion3, 19 Stats: BlockStats{ 20 NumSamples: 1, 21 NumSeries: 2, 22 NumProfiles: 3, 23 }, 24 Files: []File{ 25 { 26 RelPath: "a", 27 SizeBytes: 1, 28 }, 29 }, 30 Source: IngesterSource, 31 Compaction: BlockMetaCompaction{ 32 Level: 1, 33 Sources: []ulid.ULID{generateULID()}, 34 Deletable: true, 35 Parents: []BlockDesc{ 36 { 37 ULID: generateULID(), 38 MinTime: 1, 39 MaxTime: 2, 40 }, 41 { 42 ULID: generateULID(), 43 MinTime: 2, 44 MaxTime: 3, 45 }, 46 }, 47 Hints: []string{"a", "b"}, 48 }, 49 } 50 require.Equal(t, expected, expected.Clone()) 51 }