-
Notifications
You must be signed in to change notification settings - Fork 485
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
Handle sysctls maps #764
Handle sysctls maps #764
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.
Looks good, thanks for the PR.
Could unit tests be added? There's an example in pytests/test_container_to_args.py
.
1c741d7
to
2f8de64
Compare
When I ran the tests with
I switched the test class over to I'm not very familiar with python or its tooling, so there might be a better solution. If you want me to move the |
|
||
args0 = await container_to_args(c, cnt0) | ||
args1 = await container_to_args(c, cnt1) | ||
self.assertEqual( |
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 think this tests performs the check in a roundabout way. It's the actual contents of args which is important, not that two invocations of container_to_args produce identical results. If someone breaks sysctls completely in the future by e.g. ignoring them this test would still pass.
I think it makes sense to split test into two and compare args to an explicit list of strings like in the test above. This is more verbose, but also more readable as it's immediately clear what kind of result we are expecting.
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.
Yeah makes sense. I split it in two test cases and made the assertion explicit.
@@ -25,7 +25,7 @@ def get_minimal_container(): | |||
} | |||
|
|||
|
|||
class TestContainerToArgs(unittest.TestCase): | |||
class TestContainerToArgs(unittest.IsolatedAsyncioTestCase): |
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.
This is great discovery, thanks.
f901a92
to
08cc994
Compare
Signed-off-by: lemmi <lemmi@nerd2nerd.org>
- Add support to handle sysctls maps. - Directly raise an error if sysctls is neither an array nor map instead of letting podman fail with an unhelpful message. Support for sysctls arrays was added in containers#261. Fixes containers#754: sysctls only works with arrays, not maps Signed-off-by: lemmi <lemmi@nerd2nerd.org>
Rebased and reordered commits. |
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.
Looks great.
Support for sysctls arrays was added in #261.
Fixes #754: sysctls only works with arrays, not maps