-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4189] Fix colliding filters by updating match method for MultiCharSequenceFilter to iterate through all patterns for the most complete match and not return on the first pattern found #4188
Changes from 3 commits
caeb6f6
6086f86
1b9ea72
4b36d5f
8f0402a
2222592
604df47
dceb8da
64fe147
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,19 @@ import ( | |
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPrefixCompositeR2Filter(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like a better place to add these test cases is in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, I also think the naming also isn't great. Is R2 naming only relevant internally to Uber? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah, there's R2 references aplenty in OSS world. |
||
id0 := "arachne_failures" | ||
id1 := "arachne_failures_by_rack" | ||
f, err := newMultiCharSequenceFilter([]byte("arachne_failures,arachne_failures_by_rack"), false) | ||
require.NoError(t, err) | ||
val1, matches1 := f.matches([]byte(id0)) | ||
require.True(t, matches1) | ||
require.True(t, len(val1) == 0) | ||
val2, matches2 := f.matches([]byte(id1)) | ||
require.True(t, matches2) | ||
require.True(t, len(val2) == 0) | ||
} | ||
|
||
func TestNewFilterFromFilterValueInvalidPattern(t *testing.T) { | ||
inputs := []string{"ab]c[sdf", "abc[z-a]", "*con[tT]ains*"} | ||
for _, input := range inputs { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: seems like the
bestPattern == nil
isn't neededThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, updated.