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

[extension/cgroupruntime] Add cgroup integration tests #36545

Closed
rogercoll opened this issue Nov 26, 2024 · 2 comments · Fixed by #36617
Closed

[extension/cgroupruntime] Add cgroup integration tests #36545

rogercoll opened this issue Nov 26, 2024 · 2 comments · Fixed by #36617

Comments

@rogercoll
Copy link
Contributor

rogercoll commented Nov 26, 2024

Component(s)

extension/cgroupruntime

Is your feature request related to a problem? Please describe.

A new extension is being created to modify in runtime the values of GOMEMLIMIT and GOMAXPROCS based on the resource limits within a cgroup: #30289

The initial implementation includes the base files and unit tests needed for using the extension. However, to be part of the contrib distribution, integration tests also need to be added: #35472 (comment)

Describe the solution you'd like

Integration tests that modify cgroup resource limits and asserts the corresponding GOMEMLIMIT and GOMAXPROCS values.

Describe alternatives you've considered

No response

Additional context

No response

@rogercoll rogercoll added enhancement New feature or request needs triage New item requiring triage labels Nov 26, 2024
@rogercoll
Copy link
Contributor Author

Component label will be available after #35472

@mx-psi mx-psi added extension/cgroupruntime priority:p1 High and removed needs triage New item requiring triage labels Nov 27, 2024
Copy link
Contributor

Pinging code owners for extension/cgroupruntime: @mx-psi @rogercoll. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label.

mx-psi added a commit that referenced this issue Dec 18, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds some integration tests for the extension. It uses the
`containerd/cgroups` package to modify the current process's allocated
cgroup resources and assert the corresponding values for
GOMEMLIMIT/GOMAXPROCS set by the extension.

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
#36545

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Cgroup resources modification requires privileged access in GHA runner
instances, thus the test must be run with `sudo`. The `go` toolchain has
an `exec` flag to run tests binary(s) via another binary such as sudo.
The Makefile has been modified to run Go tests files with build tag
`integration` && `sudo` with the sudo command. I am not very confident
with this solution, as I could not find any other component requiring
privileged execution for its integration tests and the "go test
-tags=integration,sudo" would run for all of them. I am all ears on
other testing strategies for this use case.

Similar strategy in cgroups package
https://github.com/containerd/cgroups/blob/main/.github/workflows/ci.yml#L101

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
mterhar pushed a commit to mterhar/opentelemetry-collector-contrib that referenced this issue Dec 19, 2024
…#36617)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Adds some integration tests for the extension. It uses the
`containerd/cgroups` package to modify the current process's allocated
cgroup resources and assert the corresponding values for
GOMEMLIMIT/GOMAXPROCS set by the extension.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#36545

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Cgroup resources modification requires privileged access in GHA runner
instances, thus the test must be run with `sudo`. The `go` toolchain has
an `exec` flag to run tests binary(s) via another binary such as sudo.
The Makefile has been modified to run Go tests files with build tag
`integration` && `sudo` with the sudo command. I am not very confident
with this solution, as I could not find any other component requiring
privileged execution for its integration tests and the "go test
-tags=integration,sudo" would run for all of them. I am all ears on
other testing strategies for this use case.

Similar strategy in cgroups package
https://github.com/containerd/cgroups/blob/main/.github/workflows/ci.yml#L101

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants