storage: expose bug in iterators #10027

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2021-12-16 12:01:54 +01:00
parent 52c693a63b
commit b042e29569
2 changed files with 10 additions and 0 deletions

View file

@ -233,6 +233,11 @@ func TestConcreteSeriesIterator(t *testing.T) {
ts, v = it.At() ts, v = it.At()
require.Equal(t, int64(3), ts) require.Equal(t, int64(3), ts)
require.Equal(t, 3., v) require.Equal(t, 3., v)
// Seek beyond the end.
require.False(t, it.Seek(5))
// And we don't go back. (This exposes issue #10027.)
require.False(t, it.Seek(2))
} }
func TestFromQueryResultWithDuplicates(t *testing.T) { func TestFromQueryResultWithDuplicates(t *testing.T) {

View file

@ -51,4 +51,9 @@ func TestListSeriesIterator(t *testing.T) {
ts, v = it.At() ts, v = it.At()
require.Equal(t, int64(3), ts) require.Equal(t, int64(3), ts)
require.Equal(t, 3., v) require.Equal(t, 3., v)
// Seek beyond the end.
require.False(t, it.Seek(5))
// And we don't go back. (This exposes issue #10027.)
require.False(t, it.Seek(2))
} }