Skip to content

Commit

Permalink
Sort metric labels
Browse files Browse the repository at this point in the history
  • Loading branch information
CatherineF-dev committed Oct 20, 2022
1 parent 9127641 commit cccb3cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/stable/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ func compare(collectedStableMetrics []Metric, expectedStableMetrics []Metric, sk
if expectedMetric, ok = collected[name]; !ok {
return fmt.Errorf("not found stable metric %s", name)
}
if diff := cmp.Diff(metric, expectedMetric, cmpopts.IgnoreFields(Metric{}, "Help")); diff != "" {
if diff := cmp.Diff(metric, expectedMetric, cmpopts.IgnoreFields(Metric{}, "Help", "Labels")); diff != "" {
return fmt.Errorf("stable metric %s mismatch (-want +got):\n%s", name, diff)
}
if diff := cmp.Diff(metric.Labels, expectedMetric.Labels, cmpopts.SortSlices(func(l1, l2 string) bool { return l1 > l2 })); diff != "" {
return fmt.Errorf("stable metric label %s mismatch (-want +got):\n%s", name, diff)
}
}
for _, name := range sortedKeys(collected) {
if _, ok = expected[name]; !ok {
Expand Down

0 comments on commit cccb3cf

Please sign in to comment.