diff --git a/integration/compactor_test.go b/integration/compactor_test.go index b90aa0cddb5..61a3403a882 100644 --- a/integration/compactor_test.go +++ b/integration/compactor_test.go @@ -232,6 +232,17 @@ func (s sample) Type() chunkenc.ValueType { } } +func (s sample) Copy() chunks.Sample { + c := sample{t: s.t, v: s.v} + if s.h != nil { + c.h = s.h.Copy() + } + if s.fh != nil { + c.fh = s.fh.Copy() + } + return c +} + func must[T any](v T, err error) T { if err != nil { panic(err) diff --git a/pkg/compactor/compactor_test.go b/pkg/compactor/compactor_test.go index 9c739a6e53b..bd4afca4eaf 100644 --- a/pkg/compactor/compactor_test.go +++ b/pkg/compactor/compactor_test.go @@ -2380,6 +2380,17 @@ func (s sample) Type() chunkenc.ValueType { } } +func (s sample) Copy() chunks.Sample { + c := sample{t: s.t, v: s.v} + if s.h != nil { + c.h = s.h.Copy() + } + if s.fh != nil { + c.fh = s.fh.Copy() + } + return c +} + type bucketWithMockedAttributes struct { objstore.Bucket diff --git a/pkg/storegateway/gateway_test.go b/pkg/storegateway/gateway_test.go index adb936aadc2..170ac1849b7 100644 --- a/pkg/storegateway/gateway_test.go +++ b/pkg/storegateway/gateway_test.go @@ -36,6 +36,7 @@ import ( "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/tsdb" "github.com/prometheus/prometheus/tsdb/chunkenc" + "github.com/prometheus/prometheus/tsdb/chunks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -1670,6 +1671,17 @@ func (s sample) Type() chunkenc.ValueType { } } +func (s sample) Copy() chunks.Sample { + c := sample{t: s.t, v: s.v} + if s.h != nil { + c.h = s.h.Copy() + } + if s.fh != nil { + c.fh = s.fh.Copy() + } + return c +} + func defaultLimitsConfig() validation.Limits { limits := validation.Limits{} flagext.DefaultValues(&limits) diff --git a/tools/tsdb-chunks/main_test.go b/tools/tsdb-chunks/main_test.go index df995fe57ec..1ac79ddafc2 100644 --- a/tools/tsdb-chunks/main_test.go +++ b/tools/tsdb-chunks/main_test.go @@ -86,6 +86,17 @@ func (s sample) Type() chunkenc.ValueType { } } +func (s sample) Copy() chunks.Sample { + c := sample{t: s.t, v: s.v} + if s.h != nil { + c.h = s.h.Copy() + } + if s.fh != nil { + c.fh = s.fh.Copy() + } + return c +} + func must[T any](v T, err error) T { if err != nil { panic(err) diff --git a/tools/tsdb-index-health/main_test.go b/tools/tsdb-index-health/main_test.go index 32deb302a69..7965d31be79 100644 --- a/tools/tsdb-index-health/main_test.go +++ b/tools/tsdb-index-health/main_test.go @@ -86,6 +86,17 @@ func (s sample) Type() chunkenc.ValueType { } } +func (s sample) Copy() chunks.Sample { + c := sample{t: s.t, v: s.v} + if s.h != nil { + c.h = s.h.Copy() + } + if s.fh != nil { + c.fh = s.fh.Copy() + } + return c +} + func must[T any](v T, err error) T { if err != nil { panic(err) diff --git a/tools/tsdb-print-chunk/main_test.go b/tools/tsdb-print-chunk/main_test.go index 01af9d5dd27..43bcd844401 100644 --- a/tools/tsdb-print-chunk/main_test.go +++ b/tools/tsdb-print-chunk/main_test.go @@ -86,6 +86,17 @@ func (s sample) Type() chunkenc.ValueType { } } +func (s sample) Copy() chunks.Sample { + c := sample{t: s.t, v: s.v} + if s.h != nil { + c.h = s.h.Copy() + } + if s.fh != nil { + c.fh = s.fh.Copy() + } + return c +} + func must[T any](v T, err error) T { if err != nil { panic(err)