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 functions which are used in Podman, CRI-O and containerd #165

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

adrianreber
Copy link
Member

Convenience functions to check if CRIU is available and at least a certain version are now used in containerd, CRI-O and Podman. This change moves those functions to go-criu.

I am not entirely sure about the naming and the location. If this used somewhere else it would be:

import "github.com/checkpoint-restore/go-criu/v7/utils"
...
utils.GetCriuVersion()

Which results in utils, which is a very generic name. Maybe changing the directory name to crutils would be better?

import "github.com/checkpoint-restore/go-criu/v7/crutils"
...
crutils.GetCriuVersion()

Not sure. Any ideas about naming to make it easy to include and understand where it is coming from?

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 43.18182% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 50.37%. Comparing base (5d0d8f1) to head (6908ab4).

Files Patch % Lines
test/main.go 13.63% 14 Missing and 5 partials ⚠️
utils/criu_linux.go 72.72% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #165      +/-   ##
==========================================
- Coverage   50.50%   50.37%   -0.13%     
==========================================
  Files          24       25       +1     
  Lines        2865     2908      +43     
==========================================
+ Hits         1447     1465      +18     
- Misses       1220     1238      +18     
- Partials      198      205       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adrianreber adrianreber force-pushed the 2024-03-12-common branch 2 times, most recently from 409c235 to c9e3356 Compare March 12, 2024 12:30
@rst0git
Copy link
Member

rst0git commented Mar 12, 2024

@adrianreber It is common to use import aliases in Go. For example, the alias criu is used in runc:

import criu "github.com/checkpoint-restore/go-criu/v6/rpc"

utils/criu_linux.go Outdated Show resolved Hide resolved
utils/criu_linux.go Outdated Show resolved Hide resolved
@adrianreber
Copy link
Member Author

@adrianreber It is common to use import aliases in Go. For example, the alias criu is used in runc:

import criu "github.com/checkpoint-restore/go-criu/v6/rpc"

Right, but the question is, if we come with a good name, then maybe the alias would not be necessary.

Convenience functions to check if CRIU is available and at least a
certain version are now used in containerd, CRI-O and Podman. This
change moves those functions to go-criu.

Signed-off-by: Adrian Reber <areber@redhat.com>
@adrianreber
Copy link
Member Author

The missing test coverage seems to mainly in the test code. Not sure it makes sense to track test coverage in the actual test case 😉

@snprajwal snprajwal requested a review from rst0git March 14, 2024 10:25
Copy link
Member

@rst0git rst0git left a comment

Choose a reason for hiding this comment

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

LGTM

@snprajwal snprajwal merged commit 28ccaf6 into checkpoint-restore:master Mar 14, 2024
12 of 14 checks passed
@adrianreber adrianreber mentioned this pull request Mar 14, 2024
@adrianreber adrianreber deleted the 2024-03-12-common branch June 17, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants