Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <[email protected]>
  • Loading branch information
fpetkovski committed Mar 12, 2024
1 parent 369fa1f commit a4c6a4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,12 @@ func (s *ProxyStore) Series(originalRequest *storepb.SeriesRequest, srv storepb.
continue
}

matches, matched := s.tsdbSelector.MatchLabelSets(st.LabelSets()...)
matches, extraMatchers := s.tsdbSelector.MatchLabelSets(st.LabelSets()...)
if !matches {
continue
}
if len(matched) < len(st.LabelSets()) {
storeLabelSets = append(storeLabelSets, matched...)
}
storeLabelSets = append(storeLabelSets, extraMatchers...)

stores = append(stores, st)
}
if len(stores) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@ type rawSeries struct {
}

func seriesEquals(t *testing.T, expected []rawSeries, got []storepb.Series) {
testutil.Equals(t, len(expected), len(got), "got unexpected number of series: \n %v", got)
testutil.Equals(t, len(expected), len(got), "got unexpected number of series: \n want: %v \n got: %v", expected, got)

ret := make([]rawSeries, len(got))
for i, s := range got {
Expand Down
5 changes: 3 additions & 2 deletions pkg/store/tsdb_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ func NewTSDBSelector(relabelConfig []*relabel.Config) *TSDBSelector {
}

// MatchLabelSets returns true if the given label sets match the TSDBSelector.
// It also returns those label sets that were matched.
// As a second parameter, it returns the matched label sets if they are a subset of the given input.
// Otherwise the second return value is nil.
func (sr *TSDBSelector) MatchLabelSets(labelSets ...labels.Labels) (bool, []labels.Labels) {
if sr.relabelConfig == nil || len(labelSets) == 0 {
return true, labelSets
return true, nil
}
matchedLabelSets := sr.runRelabelRules(labelSets)
return len(matchedLabelSets) > 0, matchedLabelSets
Expand Down

0 comments on commit a4c6a4c

Please sign in to comment.