mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Post-merge fixes
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
e4e24453fa
commit
68e02be963
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/prometheus/prometheus/model/textparse"
|
||||
"github.com/prometheus/prometheus/prompb"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
"github.com/prometheus/prometheus/tsdb/chunkenc"
|
||||
)
|
||||
|
||||
var writeRequestFixture = &prompb.WriteRequest{
|
||||
|
@ -205,31 +206,31 @@ func TestConcreteSeriesIterator(t *testing.T) {
|
|||
it := series.Iterator()
|
||||
|
||||
// Seek to the first sample with ts=1.
|
||||
require.True(t, it.Seek(1))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(1))
|
||||
ts, v := it.At()
|
||||
require.Equal(t, int64(1), ts)
|
||||
require.Equal(t, 1., v)
|
||||
|
||||
// Seek one further, next sample still has ts=1.
|
||||
require.True(t, it.Next())
|
||||
require.Equal(t, chunkenc.ValFloat, it.Next())
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(1), ts)
|
||||
require.Equal(t, 1.5, v)
|
||||
|
||||
// Seek again to 1 and make sure we stay where we are.
|
||||
require.True(t, it.Seek(1))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(1))
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(1), ts)
|
||||
require.Equal(t, 1.5, v)
|
||||
|
||||
// Another seek.
|
||||
require.True(t, it.Seek(3))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(3))
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(3), ts)
|
||||
require.Equal(t, 3., v)
|
||||
|
||||
// And we don't go back.
|
||||
require.True(t, it.Seek(2))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(2))
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(3), ts)
|
||||
require.Equal(t, 3., v)
|
||||
|
|
|
@ -17,37 +17,45 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/prometheus/prometheus/tsdb/chunkenc"
|
||||
)
|
||||
|
||||
func TestListSeriesIterator(t *testing.T) {
|
||||
it := NewListSeriesIterator(samples{sample{0, 0}, sample{1, 1}, sample{1, 1.5}, sample{2, 2}, sample{3, 3}})
|
||||
it := NewListSeriesIterator(samples{
|
||||
sample{0, 0, nil, nil},
|
||||
sample{1, 1, nil, nil},
|
||||
sample{1, 1.5, nil, nil},
|
||||
sample{2, 2, nil, nil},
|
||||
sample{3, 3, nil, nil},
|
||||
})
|
||||
|
||||
// Seek to the first sample with ts=1.
|
||||
require.True(t, it.Seek(1))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(1))
|
||||
ts, v := it.At()
|
||||
require.Equal(t, int64(1), ts)
|
||||
require.Equal(t, 1., v)
|
||||
|
||||
// Seek one further, next sample still has ts=1.
|
||||
require.True(t, it.Next())
|
||||
require.Equal(t, chunkenc.ValFloat, it.Next())
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(1), ts)
|
||||
require.Equal(t, 1.5, v)
|
||||
|
||||
// Seek again to 1 and make sure we stay where we are.
|
||||
require.True(t, it.Seek(1))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(1))
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(1), ts)
|
||||
require.Equal(t, 1.5, v)
|
||||
|
||||
// Another seek.
|
||||
require.True(t, it.Seek(3))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(3))
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(3), ts)
|
||||
require.Equal(t, 3., v)
|
||||
|
||||
// And we don't go back.
|
||||
require.True(t, it.Seek(2))
|
||||
require.Equal(t, chunkenc.ValFloat, it.Seek(2))
|
||||
ts, v = it.At()
|
||||
require.Equal(t, int64(3), ts)
|
||||
require.Equal(t, 3., v)
|
||||
|
|
Loading…
Reference in a new issue