storage: iterator fixes after merge

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2021-12-18 14:12:01 +01:00
parent 64c7bd2b08
commit 86cc83b13c
6 changed files with 8 additions and 8 deletions

View File

@ -2830,7 +2830,7 @@ func TestScrapeReportLimit(t *testing.T) {
var found bool
for series.Next() {
i := series.At().Iterator()
for i.Next() {
for i.Next() == chunkenc.ValFloat {
_, v := i.At()
require.Equal(t, 1.0, v)
found = true

View File

@ -363,7 +363,7 @@ func (c *concreteSeriesIterator) Seek(t int64) chunkenc.ValueType {
c.cur = 0
}
if c.cur >= len(c.series.samples) {
return false
return chunkenc.ValNone
}
// No-op check.
if s := c.series.samples[c.cur]; s.Timestamp >= t {

View File

@ -236,9 +236,9 @@ func TestConcreteSeriesIterator(t *testing.T) {
require.Equal(t, 3., v)
// Seek beyond the end.
require.False(t, it.Seek(5))
require.Equal(t, chunkenc.ValNone, it.Seek(5))
// And we don't go back. (This exposes issue #10027.)
require.False(t, it.Seek(2))
require.Equal(t, chunkenc.ValNone, it.Seek(2))
}
func TestFromQueryResultWithDuplicates(t *testing.T) {

View File

@ -119,7 +119,7 @@ func (it *listSeriesIterator) Seek(t int64) chunkenc.ValueType {
it.idx = 0
}
if it.idx >= it.samples.Len() {
return false
return chunkenc.ValNone
}
// No-op check.
if s := it.samples.Get(it.idx); s.T() >= t {

View File

@ -61,7 +61,7 @@ func TestListSeriesIterator(t *testing.T) {
require.Equal(t, 3., v)
// Seek beyond the end.
require.False(t, it.Seek(5))
require.Equal(t, chunkenc.ValNone, it.Seek(5))
// And we don't go back. (This exposes issue #10027.)
require.False(t, it.Seek(2))
require.Equal(t, chunkenc.ValNone, it.Seek(2))
}

View File

@ -181,7 +181,7 @@ func (it *listSeriesIterator) Seek(t int64) chunkenc.ValueType {
it.idx = 0
}
if it.idx >= len(it.list) {
return false
return chunkenc.ValNone
}
// No-op check.
if s := it.list[it.idx]; s.t >= t {