-
Notifications
You must be signed in to change notification settings - Fork 351
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
Add test code linux_cgroups_devices #3000
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: sat0ken <[email protected]>
Signed-off-by: sat0ken <[email protected]>
Hey @sat0ken thanks for the PR! I missed replying to your message on the issue, but I would have requested you to wait a bit before opening the PR. There is another PR which makes some refactor on test code, and that has been waiting for sometime to get merged. I plan to get that merged first and then ask authors of open test PRs to rebase on the main for the changes. I'll ping you once that is done, so you can rebase, and then I'll review this one. I also request you to hold off on the relative_devices PR till that is done, but I have assigned that to you on the issue. |
@YJDoc2 OK! I got it. thank you. |
Hey @sat0ken , that PR is merged, so you can rebase this once and also work on the relative devices. However, in future I will request to only work on one PR at a time 😅 |
@YJDoc2 Thank you for notify.
I'm sorry, I'll be careful from now on. |
There is no need to apologize; @YJDoc2 has just suggested a smooth way to develop. I often make this mistake myself 🙃 |
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.
Hey, there are some changes needed. Also can you confirm this is impl of linux_cgroups_devices
and not linux_cgroups_relative_devices
?
.access(allow.to_string()) | ||
.typ(dev_type) | ||
.major(major) | ||
.minor(minor) | ||
.access(access) |
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.
Why are we setting access twice? Is one of them supposed to be allow instead?
linux_device_build(true, LinuxDeviceType::C, 10, 229, "rwm".to_string()), | ||
linux_device_build(true, LinuxDeviceType::B, 8, 20, "rw".to_string()), | ||
linux_device_build(true, LinuxDeviceType::B, 10, 200, "r".to_string()), |
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.
If we are setting true
in all three, we can instead directly set true in the function, and not pass the parameter at all.
test_result!(check_container_created(&data)); | ||
TestResult::Passed |
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.
if let TestResult::Failed(_) = test_result { | ||
return test_result; | ||
} | ||
test_result |
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 no-op, we can simply return the test_outside_container
here as the last statement in the function block
let spec = SpecBuilder::default() | ||
.linux( | ||
LinuxBuilder::default() | ||
.cgroups_path(Path::new("/runtime-test").join(cgroup_name)) |
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 is incorrect. For absolute cgroups path, it should be single level at root like /cgrouptest
. Joining another path here would make it relative.
Hey, as @utam0k mentioned, no need to apologize, in fact I apologies if my comment seemed too harsh. We haven't mentioned this in the main issue as well, which we should, and I was suggesting that so it would be easier for us to review the PRs. 😅 😄 |
This implements the linux_cgroups_devices validation in #361