Added Test For indexReader.LabelValues

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-04-08 21:12:04 +05:30
parent 329dc1fa6c
commit 86929ed090
No known key found for this signature in database
GPG Key ID: F1C217E8E9023CAD
1 changed files with 27 additions and 1 deletions

View File

@ -264,6 +264,14 @@ func TestPersistence_index_e2e(t *testing.T) {
}
i++
}
for k, v := range values {
vals := v.slice()
require.NoError(t, iw.WriteLabelIndex([]string{k}, vals))
require.NoError(t, mi.WriteLabelIndex([]string{k}, vals))
}
all := make([]uint32, len(lbls))
for i := range all {
all[i] = uint32(i)
@ -306,6 +314,24 @@ func TestPersistence_index_e2e(t *testing.T) {
require.NoError(t, gotp.Err())
}
require.NoError(t, ir.Close())
for k, v := range mi.labelIndex {
tplsExp, err := newStringTuples(v, 1)
require.NoError(t, err)
tplsRes, err := ir.LabelValues(k)
require.NoError(t, err)
require.Equal(t, tplsExp.Len(), tplsRes.Len())
for i := 0; i < tplsExp.Len(); i++ {
strsExp, err := tplsExp.At(i)
require.NoError(t, err)
strsRes, err := tplsRes.At(i)
require.NoError(t, err)
require.Equal(t, strsExp, strsRes)
}
}
require.NoError(t, ir.Close())
}