-
Notifications
You must be signed in to change notification settings - Fork 355
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
Migrate to tempfile
for libcontainer
and youki
crate
#1887
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 tasks
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1887 +/- ##
==========================================
+ Coverage 67.57% 67.61% +0.03%
==========================================
Files 125 125
Lines 14199 14204 +5
==========================================
+ Hits 9595 9604 +9
+ Misses 4604 4600 -4 |
Signed-off-by: yihuaf <[email protected]>
Signed-off-by: yihuaf <[email protected]>
utam0k
reviewed
May 8, 2023
utam0k
reviewed
May 8, 2023
utam0k
reviewed
May 8, 2023
Signed-off-by: yihuaf <[email protected]>
@utam0k Addressed the review. PTAL :) |
utam0k
approved these changes
May 9, 2023
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.
Thanks
use std::fs; | ||
use std::path::{Path, PathBuf}; | ||
|
||
pub fn determine(root_path: Option<PathBuf>) -> Result<PathBuf> { |
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.
😍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As explained in #1883, we would like to move away from rolling out our own tempdir implementation. This is the first PR to migrate
libcontainer
andyouki
crate. Thelibcgroup
andintegrate_test
will follow.A few notes:
First, I remove using test name to create unique tempdir. Since the tempdir are designed to go away once out of the scope, using random names is enough to create unique tempdir. The directory will be removed regardless of test successful or not, so there is no reason to use human readable names.
Second, a number of test is partly re-written so it works better with the
tempdir
crate. Notably, we introducedscopeguard
anddefer!()
to recreate theDrop
delete a specific path that is not inside a tempdir logic. I find this to communicate the intent of the test more clear.Third, for
Rootless
, I decided to introduce dependency injection to make the uid/gid mapping path configurable, so test can pass in a path instead of hardcode to a specific path.