Add regression test

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-06-13 13:21:22 +05:30
parent 9e1f34dae3
commit a280169427
No known key found for this signature in database
GPG key ID: F1C217E8E9023CAD

View file

@ -1027,6 +1027,22 @@ func TestSeriesIterator(t *testing.T) {
return return
} }
// Regression for: https://github.com/prometheus/tsdb/pull/97
func TestCSIteratorDoubleSeek(t *testing.T) {
chkMetas := []*ChunkMeta{
chunkFromSamples([]sample{}),
chunkFromSamples([]sample{{1, 1}, {2, 2}, {3, 3}}),
chunkFromSamples([]sample{{4, 4}, {5, 5}}),
}
res := newChunkSeriesIterator(chkMetas, nil, 2, 8)
require.True(t, res.Seek(1))
require.True(t, res.Seek(2))
ts, v := res.At()
require.Equal(t, int64(2), ts)
require.Equal(t, float64(2), v)
}
func TestPopulatedCSReturnsValidChunkSlice(t *testing.T) { func TestPopulatedCSReturnsValidChunkSlice(t *testing.T) {
lbls := []labels.Labels{labels.New(labels.Label{"a", "b"})} lbls := []labels.Labels{labels.New(labels.Label{"a", "b"})}
chunkMetas := [][]*ChunkMeta{ chunkMetas := [][]*ChunkMeta{