Skip to content

Commit

Permalink
fix: Make policy test non-flaky (#16158)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanGuedes authored Feb 10, 2025
1 parent 7e7782e commit 41d9c8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/validation/ingestion_policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Test_PolicyStreamMapping_PolicyFor(t *testing.T) {
"policy3": []*PriorityStream{
{
Selector: `{qyx="qzx", qox="qox"}`,
Priority: 1,
Priority: 2,
Matchers: []*labels.Matcher{
labels.MustNewMatcher(labels.MatchEqual, "qyx", "qzx"),
labels.MustNewMatcher(labels.MatchEqual, "qox", "qox"),
Expand All @@ -51,7 +51,7 @@ func Test_PolicyStreamMapping_PolicyFor(t *testing.T) {
"policy5": []*PriorityStream{
{
Selector: `{qab=~"qzx.*"}`,
Priority: 1,
Priority: 2,
Matchers: []*labels.Matcher{
labels.MustNewMatcher(labels.MatchRegexp, "qab", "qzx.*"),
},
Expand Down Expand Up @@ -94,7 +94,7 @@ func Test_PolicyStreamMapping_PolicyFor(t *testing.T) {
require.Equal(t, "policy1", mapping.PolicyFor(labels.FromStrings("foo", "bar")))
// matches both policy2 and policy1 but policy1 has higher priority.
require.Equal(t, "policy1", mapping.PolicyFor(labels.FromStrings("foo", "bar", "daz", "baz")))
// matches policy3 and policy4 but policy3 appears first.
// matches policy3 and policy4 but policy3 has higher priority..
require.Equal(t, "policy3", mapping.PolicyFor(labels.FromStrings("qyx", "qzx", "qox", "qox")))
// matches no policy.
require.Equal(t, "", mapping.PolicyFor(labels.FromStrings("foo", "fooz", "daz", "qux", "quux", "corge")))
Expand Down

0 comments on commit 41d9c8b

Please sign in to comment.