-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add ulimits to podman update
#26445
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
base: main
Are you sure you want to change the base?
Add ulimits to podman update
#26445
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aaron-ang The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
2 similar comments
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
Hi, I did a quick code check. And you need to move this definition of the |
The commit needs a sign off, see https://github.com/containers/podman/blob/main/CONTRIBUTING.md#sign-your-prs Also please add the |
test/system/280-update.bats
Outdated
# bats test_tags=distro-integration | ||
@test "podman update - test all options" { | ||
local cgv=1 | ||
if is_cgroupsv2; then | ||
cgv=2; | ||
cgv=2 |
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.
please don't change the formatting of unrelated parts of this file.
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.
@Luap99 does this apply to subsequent formatting changes too?
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.
yes everything that is not related to this specific new test should not be touched as it will make git blame much harder to use.
(Now if anybody has opinions abut using a consistent formatter they can voice their arguments here #26340)
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.
reverted the changes
test/e2e/update_test.go
Outdated
@@ -306,4 +306,65 @@ var _ = Describe("Podman update", func() { | |||
Expect(env).ToNot(ContainSubstring("FOO")) | |||
Expect(env).To(ContainSubstring("PATH=")) | |||
}) | |||
|
|||
It("podman update sets ulimits", func() { | |||
session := podmanTest.Podman([]string{"run", "-dt", ALPINE}) |
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.
please consider podmanTest.PodmanExitCleanly
here and throughout the new test where applicable
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.
updated to reflect this
22d4ec1
to
81fe400
Compare
What is the merge workflow for this project? Should I always squash my commits into a single commit? |
Fixes containers#26381 Signed-off-by: Aaron Ang <[email protected]>
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.
Does this work correctly with --ulimit host
on update? AFAICT it should unset all limts from the spec but the parser sets it to nil which means the update code considers it unset? I think the code likely needs to pass an explicit empty slice in that case?
# Test persists across container restart | ||
run_podman restart $ctrname | ||
|
||
# Verify the ulimits persist after restart | ||
run_podman exec $ctrname sh -c "ulimit -n" | ||
assert "$output" == "2048" "nofile ulimit persists after restart" | ||
|
||
run_podman exec $ctrname sh -c "ulimit -u" | ||
assert "$output" == "512" "nproc ulimit persists after restart" |
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.
Note you aren't actually verifying that the ulimit is set correctly for the main container process. exec spawns a new process so it has its own limits compared to the main pid.
You likely need to run something like `sh -c "ulimit -n; ulimit -u; sleep 100" as main process and then check with podman logs that the output has the right values.
run_podman 125 update --ulimit nofile:1024:1024 $ctrname | ||
assert "$output" =~ "error" "Invalid ulimit syntax should fail" | ||
|
||
run_podman 125 update --ulimit nofile=2048:1024 $ctrname | ||
assert "$output" =~ "error" "Invalid ulimit values should fail" |
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.
That is a match is bad, checking for just "error" can be anything. You should check for the proper error message so you know the actual right error is being returned to users.
For a small feature like this yes. In general commits must be logical units and we prefer code, test and docs to be part of the same commit. However if you do some slight refactoring or fix multiple things than they should be in separate commits. |
Fixes #26381
Does this PR introduce a user-facing change?