From b042e29569eb99d57e3175e05cb16330160637ae Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 16 Dec 2021 12:01:54 +0100 Subject: [PATCH] storage: expose bug in iterators #10027 Signed-off-by: beorn7 --- storage/remote/codec_test.go | 5 +++++ storage/series_test.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/storage/remote/codec_test.go b/storage/remote/codec_test.go index 1432736e1..be52bd312 100644 --- a/storage/remote/codec_test.go +++ b/storage/remote/codec_test.go @@ -233,6 +233,11 @@ func TestConcreteSeriesIterator(t *testing.T) { ts, v = it.At() require.Equal(t, int64(3), ts) 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) { diff --git a/storage/series_test.go b/storage/series_test.go index 384009de4..8ce4a7222 100644 --- a/storage/series_test.go +++ b/storage/series_test.go @@ -51,4 +51,9 @@ func TestListSeriesIterator(t *testing.T) { ts, v = it.At() require.Equal(t, int64(3), ts) 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)) }