Merge pull request #13415 from aknuds1/arve/test-label-values-with-matchers-one-more
TestLabelValuesWithMatchers: Add test case
This commit is contained in:
commit
f52605b584
|
@ -235,6 +235,13 @@ func TestLabelValuesWithMatchers(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
defer func() { require.NoError(t, indexReader.Close()) }()
|
defer func() { require.NoError(t, indexReader.Close()) }()
|
||||||
|
|
||||||
|
var uniqueWithout30s []string
|
||||||
|
for i := 0; i < 100; i++ {
|
||||||
|
if i/10 != 3 {
|
||||||
|
uniqueWithout30s = append(uniqueWithout30s, fmt.Sprintf("value%d", i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Strings(uniqueWithout30s)
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
labelName string
|
labelName string
|
||||||
|
@ -261,6 +268,14 @@ func TestLabelValuesWithMatchers(t *testing.T) {
|
||||||
labelName: "tens",
|
labelName: "tens",
|
||||||
matchers: []*labels.Matcher{labels.MustNewMatcher(labels.MatchNotEqual, "unique", "")},
|
matchers: []*labels.Matcher{labels.MustNewMatcher(labels.MatchNotEqual, "unique", "")},
|
||||||
expectedValues: []string{"value0", "value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9"},
|
expectedValues: []string{"value0", "value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9"},
|
||||||
|
}, {
|
||||||
|
name: "get unique IDs based on tens not being equal to a certain value, while not empty",
|
||||||
|
labelName: "unique",
|
||||||
|
matchers: []*labels.Matcher{
|
||||||
|
labels.MustNewMatcher(labels.MatchNotEqual, "tens", "value3"),
|
||||||
|
labels.MustNewMatcher(labels.MatchNotEqual, "tens", ""),
|
||||||
|
},
|
||||||
|
expectedValues: uniqueWithout30s,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue