fix upstream match for linux-.*-headers-.*#2320
Conversation
Signed-off-by: Bar Nuri <barnuri@hotmail.com>
kzantow
left a comment
There was a problem hiding this comment.
We should figure out how to add some tests for this, maybe something in the test/cli package?
i think its very small change and no so familiar with your tests |
|
@kzantow ? |
|
hi! any updates? I've tried to look and see if it is easy to add tests here but I didn't find any simple way (and its looks like a small change which can reduce lots of FP) |
|
I still think we should add a test -- a small change like this could easily regress without one. How about updating these "ignore" tests? |
|
I've noticed the UT is not protecting as expected the code, since the ignore rules are inside the root: but they are manually built in the ignore_test, so in case of a change it doesn't detect it. I suggest moving it or refactor the tests.. not sure how. |
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: tomersein <tomersein@gmail.com>
|
@kzantow hi there is any update of this review ? |
| pattern, err := packageNameRegex(name) | ||
| if err != nil { | ||
| continue | ||
| } |
There was a problem hiding this comment.
I think this should be moved outside of the returned func, the same way ifPackageNameApplies checks the regex once and returns an "always false" func; and we should add debug logging for failures in both places e.g.:
func ifUpstreamPackageNameApplies(name string) ignoreCondition {
pattern, err := packageNameRegex(name)
if err != nil {
log.WithFields("name", name, "error", err).Debug("unable to parse name expression")
return func(Match) bool { return false }
}
return func(match Match) bool {
for _, upstream := range match.Package.Upstreams {
if pattern.MatchString(upstream.Name) {
return true
}
}
return false
}
}
kzantow
left a comment
There was a problem hiding this comment.
This looks great -- one small tweak requested
Signed-off-by: tomersein <tomersein@gmail.com>
|
hi @kzantow , pushed a fix :) |
There was a problem hiding this comment.
Thanks for the contribution, @barnuri and @tomersein !
a fix for this PR, the upstream of linux-.-headers-. is linux-aws, linux-azure etc
#2295