Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: SungJin1212 <[email protected]>
  • Loading branch information
SungJin1212 committed Feb 5, 2025
1 parent 7e979c4 commit 9f6f9b0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
9 changes: 7 additions & 2 deletions pkg/api/query/v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"time"

"github.com/efficientgo/core/testutil"
"github.com/go-kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/common/promslog"
"github.com/prometheus/common/route"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
Expand Down Expand Up @@ -851,7 +851,7 @@ func TestMetadataEndpoints(t *testing.T) {
series = append(series, storage.NewListSeries(lbl, samples))
}

_, err := tsdb.CreateBlock(series, dir, chunkRange, log.NewNopLogger())
_, err := tsdb.CreateBlock(series, dir, chunkRange, promslog.NewNopLogger())
testutil.Ok(t, err)

opts := tsdb.DefaultOptions()
Expand Down Expand Up @@ -2165,3 +2165,8 @@ func (s sample) FH() *histogram.FloatHistogram {
func (s sample) Type() chunkenc.ValueType {
return chunkenc.ValFloat
}

func (s sample) Copy() chunks.Sample {
c := sample{t: s.t, f: s.f}
return c
}
9 changes: 8 additions & 1 deletion pkg/dedup/chunk_iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,14 @@ func (h histoSample) Type() chunkenc.ValueType {
}

func (h histoSample) Copy() chunks.Sample {
return h
c := histoSample{}
if h.h != nil {
c.h = h.h.Copy()
}
if h.fh != nil {
c.fh = h.fh.Copy()
}
return c
}

var histogramSample = &histogram.Histogram{
Expand Down
3 changes: 2 additions & 1 deletion pkg/dedup/iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func (s sample) Type() chunkenc.ValueType {
}

func (s sample) Copy() chunks.Sample {
return s
c := sample{t: s.t, f: s.f}
return c
}

type series struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/store/storepb/testutil/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (

"github.com/cespare/xxhash/v2"
"github.com/efficientgo/core/testutil"
"github.com/go-kit/log"
"github.com/gogo/protobuf/types"
"github.com/oklog/ulid"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
Expand Down Expand Up @@ -61,7 +61,7 @@ type HeadGenOptions struct {
}

func CreateBlockFromHead(t testing.TB, dir string, head *tsdb.Head) ulid.ULID {
compactor, err := tsdb.NewLeveledCompactor(context.Background(), nil, log.NewNopLogger(), []int64{1000000}, nil, nil)
compactor, err := tsdb.NewLeveledCompactor(context.Background(), nil, promslog.NewNopLogger(), []int64{1000000}, nil, nil)
testutil.Ok(t, err)

testutil.Ok(t, os.MkdirAll(dir, 0777))
Expand Down
5 changes: 3 additions & 2 deletions pkg/testutil/e2eutil/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/go-kit/log"
"github.com/oklog/ulid"
"github.com/pkg/errors"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/timestamp"
Expand Down Expand Up @@ -600,7 +601,7 @@ func createBlock(
if err := g.Wait(); err != nil {
return id, err
}
c, err := tsdb.NewLeveledCompactor(ctx, nil, log.NewNopLogger(), []int64{maxt - mint}, nil, nil)
c, err := tsdb.NewLeveledCompactor(ctx, nil, promslog.NewNopLogger(), []int64{maxt - mint}, nil, nil)
if err != nil {
return id, errors.Wrap(err, "create compactor")
}
Expand Down Expand Up @@ -764,7 +765,7 @@ func CreateBlockWithChurn(
return id, errors.Wrap(err, "commit")
}

c, err := tsdb.NewLeveledCompactor(ctx, nil, log.NewNopLogger(), []int64{maxt - mint}, nil, nil)
c, err := tsdb.NewLeveledCompactor(ctx, nil, promslog.NewNopLogger(), []int64{maxt - mint}, nil, nil)
if err != nil {
return id, errors.Wrap(err, "create compactor")
}
Expand Down

0 comments on commit 9f6f9b0

Please sign in to comment.