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

Integration test: cgroup v1 relative-cpus tests #2898

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

Conversation

posutsai
Copy link
Contributor

@posutsai posutsai commented Aug 28, 2024

Hi, I have implemented the test_relative_cpus function to contribute to #361 by referencing linux_cgroups_relative_cpus.go and cpu/v2.rs. However, I encountered a few issues:

The current implementation closely mirrors the logic in v2.rs. Since there isn't a clear distinction between v1 and v2 logic in linux_cgroups_relative_cpus.go, would it be better to extract the common logic into a shared module?

I am also unsure about the correct way to run the tests. The just test-contest command on the main branch fails on Ubuntu 20.04. Could you provide guidance on resolving this issue?

Thank you for your help. I have learned a lot from this process.

Signed-off-by: posutsai <posutsai@gmail.com>
@utam0k
Copy link
Member

utam0k commented Aug 28, 2024

@YJDoc2 May I ask you to review this PR?

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Aug 28, 2024

Sure, I'll take a look at this 👍

@YJDoc2 YJDoc2 self-assigned this Aug 28, 2024
@YJDoc2 YJDoc2 self-requested a review August 28, 2024 13:36
Signed-off-by: posutsai <posutsai@gmail.com>
@posutsai posutsai changed the title Integration test: cgroup v1 relative-cpus tests draft:Integration test: cgroup v1 relative-cpus tests Aug 30, 2024
@posutsai posutsai changed the title draft:Integration test: cgroup v1 relative-cpus tests Integration test: cgroup v1 relative-cpus tests Aug 30, 2024
@posutsai
Copy link
Contributor Author

Sorry, I would like to make some refinement. @YJDoc2 , Could you please review later?

Signed-off-by: posutsai <posutsai@gmail.com>
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Sep 2, 2024

@posutsai , sure. May I request you to mark this as draft and ping me when this is ready to review?
Also instead of having multiple functions or dealing with any, I can suggest two ways -

  1. make function generic with type parameter constrained by PartialEq,Eq , that way you can use == operator. Might need some more bounds
  2. just take everything as string. So instead of giving 1000 as number we give it as a string for expected value. Not the best way, but I think good enough for test result evaluation.

@posutsai posutsai marked this pull request as draft September 2, 2024 07:15
@posutsai
Copy link
Contributor Author

posutsai commented Sep 2, 2024

Thank you. I have turned it to draft. Also I would like to know should I do the check in test_cpu_cgroups instead of declaring another function.

Signed-off-by: posutsai <posutsai@gmail.com>
Signed-off-by: posutsai <posutsai@gmail.com>
@posutsai
Copy link
Contributor Author

posutsai commented Sep 2, 2024

Hi, @YJDoc2 I believe the review can resume. I use ToString input type to handle different and check equality between string. Thank you.

@posutsai posutsai marked this pull request as ready for review September 2, 2024 12:32
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.

Some changes, overall ok 👍
Thanks :)

tests/contest/contest/src/tests/cgroups/cpu/v1.rs Outdated Show resolved Hide resolved
tests/contest/contest/src/tests/cgroups/cpu/v1.rs Outdated Show resolved Hide resolved
tests/contest/contest/src/tests/cgroups/cpu/v1.rs Outdated Show resolved Hide resolved
tests/contest/contest/src/tests/cgroups/cpu/v1.rs Outdated Show resolved Hide resolved
Signed-off-by: posutsai <posutsai@gmail.com>
Signed-off-by: posutsai <posutsai@gmail.com>
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Sep 18, 2024

Hey, so I should have asked this a long time back, but even I'm catching this right now - What you have implemented is still using the absolute cgroup path right? This does not have anything corresponding to https://github.com/opencontainers/runtime-tools/blob/master/validation/linux_cgroups_relative_cpus/linux_cgroups_relative_cpus.go#L24 which sets the relative cgroup path.

@posutsai
Copy link
Contributor Author

Hi @YJDoc2, please correct me if I am wrong. According to my understanding, the point of the unit test is to check correctness of the config related to relative CPU resource allocation e.g. shares, quota, period etc. instead of taking relative path as argument.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Sep 24, 2024

According to my understanding, the point of the unit test is to check correctness of the config related to relative CPU resource allocation e.g. shares, quota, period etc. instead of taking relative path as argument.

Hey so from what I saw, if you check other relative* cgroup tests, the common thing is setting the relative cgroup path. If you see https://github.com/opencontainers/runtime-tools/blob/master/validation/linux_cgroups_cpus/linux_cgroups_cpus.go , which is non-relative, it still uses shares , quotas etc. So I think the aim of this test is to check correct usage of relative cgroup path.

Signed-off-by: posutsai <posutsai@gmail.com>
@posutsai posutsai force-pushed the integration-test-cgroups-relative-cpus branch from 2fd67fe to f21eea0 Compare October 18, 2024 09:47
Signed-off-by: posutsai <posutsai@gmail.com>
@posutsai
Copy link
Contributor Author

Hi, sorry for late reply. I've modified the code to use get_subsystem_mount_point and take relative path as input. Not sure if I do it the right way.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Oct 22, 2024

Hi, sorry for late reply.

No worries! I'll try to take a look at this today or so.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Oct 28, 2024

Hey, sorry it took me a while to get to this, got busy with other stuff. So in your recent changes, you are correctly taking it using the function however you are not setting the cgroup path as relative in the spec. For reference I'd suggest to take a look at https://github.com/containers/youki/pull/2686/files# , and see how it is done there, specifically https://github.com/containers/youki/pull/2686/files#diff-682de1209b41c713baac9258d0206875be877e6453cba0834357f52050d0520eR18-R21

I'll also suggest to take a look at discussion there, it seems the original author might not be continuing with the PR, so if you're fine with it, you might be able to take that one up after this (if you want).

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Nov 23, 2024

@posutsai , ping!

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 13, 2024

Hey @posutsai , let me know if you have any issues, or cannot work this anymore. It is ok if you are busy with something else, just let me know so we can proceed accordingly. Thanks :)

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