Skip to content

Commit

Permalink
test(promhandler): properly compare label matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed May 13, 2024
1 parent 87521cb commit 841b03b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internal/promhandler/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,19 @@ func TestParseLabelMatchers(t *testing.T) {
return
}
require.NoError(t, err)
require.Equal(t, tt.want, got)

// LabelMatcher cannot be compared with DeepEqual.
//
// See https://github.com/prometheus/prometheus/blob/3b8b57700c469c7cde84e1d8f9d383cb8fe11ab0/promql/parser/parse_test.go#L3719.
require.Len(t, got, len(tt.want))
for i, set := range tt.want {
gotSet := got[i]
require.Len(t, gotSet, len(set))
for i, m := range set {
gotMatcher := gotSet[i]
require.Equal(t, m.String(), gotMatcher.String())
}
}
})
}
}

0 comments on commit 841b03b

Please sign in to comment.