Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sat0ken
Copy link
Contributor

@sat0ken sat0ken commented Nov 21, 2024

This implements the linux_cgroups_devices validation in #361

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Nov 23, 2024

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.

@sat0ken
Copy link
Contributor Author

sat0ken commented Nov 24, 2024

@YJDoc2 OK! I got it. thank you.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Nov 27, 2024

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 😅

@sat0ken
Copy link
Contributor Author

sat0ken commented Nov 27, 2024

@YJDoc2 Thank you for notify.

However, in future I will request to only work on one PR at a time 😅

I'm sorry, I'll be careful from now on.

@utam0k
Copy link
Member

utam0k commented Dec 2, 2024

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 🙃

Copy link
Collaborator

@YJDoc2 YJDoc2 left a 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 ?

Comment on lines +25 to +29
.access(allow.to_string())
.typ(dev_type)
.major(major)
.minor(minor)
.access(access)
Copy link
Collaborator

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?

Comment on lines +57 to +59
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()),
Copy link
Collaborator

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.

Comment on lines +64 to +65
test_result!(check_container_created(&data));
TestResult::Passed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to check container is created AND the devices are setup correctly using a function like this .
See the runtimeOutsideValidate call in the original test here , where we call the above function to validate the devices.

Comment on lines +67 to +70
if let TestResult::Failed(_) = test_result {
return test_result;
}
test_result
Copy link
Collaborator

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))
Copy link
Collaborator

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.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 3, 2024

I'm sorry, I'll be careful from now on.

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. 😅 😄

@sat0ken
Copy link
Contributor Author

sat0ken commented Dec 4, 2024

@utam0k @YJDoc2

Thank you review and kind comment!

I apologies if my comment seemed too harsh.

Don't worry about it.
I'm newbie about Rust and container, but I enjoying to contribute to youki. I will fix the code, wait please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants