Skip to content

Commit

Permalink
Fixed tests, removed unused code
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fixed tests, removed unused code

Signed-off-by: Sebastian Rabenhorst <[email protected]>

Fixed tests, removed unused code

Signed-off-by: Sebastian Rabenhorst <[email protected]>
  • Loading branch information
rabenhorst committed Jul 24, 2023
1 parent faef3c8 commit b0fe416
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/compact/downsample/downsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ func (it *AverageChunkIterator) Next() chunkenc.ValueType {

if st == chunkenc.ValFloatHistogram {
_, sumV := it.sumIt.AtFloatHistogram()
it.fh = sumV.Scale(1 / cntV)
it.fh = sumV.Mul(1 / cntV)
return chunkenc.ValFloatHistogram
}

Expand Down
13 changes: 3 additions & 10 deletions pkg/store/storepb/testutil/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type HeadGenOptions struct {
PrependLabels labels.Labels
SkipChunks bool // Skips chunks in returned slice (not in generated head!).
SampleType chunkenc.ValueType
IncludeName bool

Random *rand.Rand
}
Expand Down Expand Up @@ -180,10 +179,7 @@ func CreateBlockFromHead(t testing.TB, dir string, head *tsdb.Head) ulid.ULID {
}

func appendFloatSamples(t testing.TB, app storage.Appender, tsLabel int, opts HeadGenOptions) {
lblSet := labels.FromStrings("foo", "bar", "i", fmt.Sprintf("%07d%s", tsLabel, LabelLongSuffix))
if opts.IncludeName {
lblSet = append(lblSet, labels.Label{Name: "__name__", Value: "test_float_metric"})
}
lblSet := labels.FromStrings("foo", "bar", "i", fmt.Sprintf("%07d%s", tsLabel, LabelLongSuffix), "j", fmt.Sprintf("%v", tsLabel))
ref, err := app.Append(0, lblSet, int64(tsLabel)*opts.ScrapeInterval.Milliseconds(), opts.Random.Float64())
testutil.Ok(t, err)

Expand All @@ -196,10 +192,7 @@ func appendFloatSamples(t testing.TB, app storage.Appender, tsLabel int, opts He
func appendHistogramSamples(t testing.TB, app storage.Appender, tsLabel int, opts HeadGenOptions) {
histograms := tsdbutil.GenerateTestHistograms(opts.SamplesPerSeries)

lblSet := labels.FromStrings("foo", "bar", "i", fmt.Sprintf("%07d%s", tsLabel, LabelLongSuffix))
if opts.IncludeName {
lblSet = append(lblSet, labels.Label{Name: "__name__", Value: "test_metric"})
}
lblSet := labels.FromStrings("foo", "bar", "i", fmt.Sprintf("%07d%s", tsLabel, LabelLongSuffix), "j", fmt.Sprintf("%v", tsLabel))
ref, err := app.AppendHistogram(
0,
lblSet,
Expand Down Expand Up @@ -318,7 +311,7 @@ func TestServerSeries(t testutil.TB, store storepb.StoreServer, cases ...*Series
}

// Huge responses can produce unreadable diffs - make it more human readable.
if len(c.ExpectedSeries) > 1 {
if len(c.ExpectedSeries) > 4 {
for j := range c.ExpectedSeries {
testutil.Equals(t, c.ExpectedSeries[j].Labels, srv.SeriesSet[j].Labels, "%v series chunks mismatch", j)

Expand Down

0 comments on commit b0fe416

Please sign in to comment.