-
Notifications
You must be signed in to change notification settings - Fork 366
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
Fix invalid prerelease characters when parse kernel version #2450
Conversation
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.
Thanks @Jexf for fixing it. Can you link the PR to its issue by adding the keyword "Fixes #xx" in the PR description? So that it can be more clear what's this for and merging it can close that issue automatically.
pkg/util/runtime/runtime_linux.go
Outdated
} | ||
patch := regexp.MustCompilePOSIX(`^[0-9]+`).FindString(verStrs[2]) | ||
if patch == "" { | ||
verStrs[2] = "0" |
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.
Is there a case the kernel release doesn't have patch number?
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.
Is there a case the kernel release doesn't have patch number?
Maybe there is no need to check kernel patch number, the kernel patch usually be numbers, and it will lose prerelease value, I will remove it.
/test-all |
/test-all |
Codecov Report
@@ Coverage Diff @@
## main #2450 +/- ##
==========================================
+ Coverage 59.79% 64.88% +5.08%
==========================================
Files 284 284
Lines 22171 25419 +3248
==========================================
+ Hits 13258 16493 +3235
+ Misses 7490 7374 -116
- Partials 1423 1552 +129
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
I have a question about why there is a special handling for "5.0" case but not for "5".
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.
LGTM
@antoninbas since you added the function, could you please take a look?
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.
LGTM, but do you think we could have a quick unit test for this function now that we have added some logic? Should be very quick to build a table-driven test.
Thanks for reminding, I have added unit test, please review again : ) @antoninbas @tnqn |
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.
LGTM
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.
I actually had a couple of comments
I noticed that you didn't sign the commit, so the DCO check is failing. https://github.com/antrea-io/antrea/blob/main/CONTRIBUTING.md#sign-off-your-work
if tc.expectedError != nil { | ||
assert.Equal(t, tc.expectedError, err) | ||
} else { | ||
assert.Nil(t, err) |
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.
should probably be require.Nil
to bypass the next check in case of an error
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.
Thanks for reminding, already updated.
}, | ||
} | ||
for _, tc := range testcases { | ||
expectedKernelVersion, err := parseKernelVersionStr(tc.kernelString) |
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.
s/expectedKernelVersion/parsedKernelVersion
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.
Thanks for reminding, already updated.
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.
LGTM, thanks!
@Jexf DCO check failed:
The signed-off author needs to be exactly same as the author information of the commit. |
/test-all |
Has been updated : ) |
Check kernel version splitted array length and intercept the first 3 elements for parsing kernel version. Signed-off-by: Wu zhengdong <zhengdong.wu@transwarp.io>
/test-all |
1 similar comment
/test-all |
Unrelated Kind test failure |
Check kernel version splitted array length and intercept the first 3 elements for parsing kernel version.
Fixes #2449
Signed-off-by: Zhengdong Wu zhengdong.wu@transwarp.io