Incorporate feedback on #36

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-04-22 01:38:26 +05:30
parent 239f8b9eb5
commit 725b69caa1
No known key found for this signature in database
GPG key ID: F1C217E8E9023CAD
3 changed files with 118 additions and 111 deletions

View file

@ -1,8 +1,7 @@
package tsdb package tsdb
import ( import (
"errors" "github.com/pkg/errors"
"github.com/prometheus/tsdb/chunks" "github.com/prometheus/tsdb/chunks"
) )

View file

@ -138,7 +138,7 @@ func TestMultiMerge(t *testing.T) {
} }
} }
func TestMerge(t *testing.T) { func TestMergedPostings(t *testing.T) {
var cases = []struct { var cases = []struct {
a, b []uint32 a, b []uint32
res []uint32 res []uint32
@ -169,7 +169,9 @@ func TestMerge(t *testing.T) {
require.Equal(t, c.res, res) require.Equal(t, c.res, res)
} }
t.Run("Seek", func(t *testing.T) { }
func TestMergedPostingsSeek(t *testing.T) {
var cases = []struct { var cases = []struct {
a, b []uint32 a, b []uint32
@ -234,7 +236,6 @@ func TestMerge(t *testing.T) {
} }
return return
})
} }
func TestBigEndian(t *testing.T) { func TestBigEndian(t *testing.T) {

View file

@ -261,12 +261,26 @@ func TestBlockQuerier(t *testing.T) {
} }
} }
// Build the querier on data first. Then execute queries on it. type query struct {
basedata := [][]struct { dataIdx int
mint, maxt int64
ms []labels.Matcher
exp SeriesSet
}
cases := struct {
data []struct {
lset map[string]string
chunks [][]sample
}
queries []query
}{
data: []struct {
lset map[string]string lset map[string]string
chunks [][]sample chunks [][]sample
}{ }{
{
{ {
lset: map[string]string{ lset: map[string]string{
"a": "a", "a": "a",
@ -308,15 +322,8 @@ func TestBlockQuerier(t *testing.T) {
}, },
}, },
}, },
}
cases := []struct { queries: []query{
dataIdx int
mint, maxt int64
ms []labels.Matcher
exp SeriesSet
}{
{ {
dataIdx: 0, dataIdx: 0,
@ -361,12 +368,12 @@ func TestBlockQuerier(t *testing.T) {
), ),
}), }),
}, },
},
} }
Outer: Outer:
for _, c := range cases { for _, c := range cases.queries {
ir, cr := createIdxChkReaders(basedata[c.dataIdx]) ir, cr := createIdxChkReaders(cases.data)
querier := &blockQuerier{ querier := &blockQuerier{
index: ir, index: ir,
chunks: cr, chunks: cr,