-
Notifications
You must be signed in to change notification settings - Fork 346
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 process test #2968
base: main
Are you sure you want to change the base?
Add process test #2968
Conversation
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
I figure out why the test failed. I reproduced it on my PC.
But runc is, even if /test is not in rootfs, runc run is working.
If we add a test directory to the rootfs you use for testing, the tests will pass. Sorry, I don't understand the detailed code of runc or youki, but I think it looks like runc is creating the cwd directory in this line. What is the difference between the behavior of runc and youki? |
Hey, thanks for the ping, I'll try to take a look at this today. |
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.
Some comments, also there are several warnings from the CI check, please take a look
@@ -20,7 +20,6 @@ fn get_spec() -> Spec { | |||
} | |||
} | |||
|
|||
////////// ANCHOR: example_runtimetest_main |
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.
Why is this line removed here?
fn process_test() -> TestResult { | ||
let spec = test_result!(create_spec()); | ||
test_inside_container(spec, &|_| { | ||
match fs::create_dir("/test") { |
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.
This should not be /test
, you should take the bundle param in the closure and append /test
and create that dir. This callback is run in host's fs before running the container, so you should be using bundle path and create this dir.
use std::fs::{self, read_dir}; | ||
use std::os::linux::fs::MetadataExt; | ||
use std::os::unix::fs::{FileTypeExt, PermissionsExt}; | ||
use std::path::Path; | ||
|
||
use anyhow::{bail, Result}; | ||
|
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.
remove this extra blank line.
if env::var("testa").unwrap().to_string().ne("valuea") { | ||
eprintln!( | ||
"error due to spec environment value of testa want {:?}, got {:?}", | ||
"valuea", | ||
env::var("testa") | ||
) | ||
} | ||
|
||
if env::var("testb").unwrap().to_string().ne("123") { | ||
eprintln!( | ||
"error due to spec environment value of testb want {:?}, got {:?}", | ||
"123", | ||
env::var("testb") | ||
) | ||
} | ||
} |
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.
I think for this as well, we should cross check this with env from the spec, similar to how the go test is doing.
Hey @sat0ken , I took a look at the code and there are two things -
|
Also @sat0ken a small request, please ping/comment in the tracking issue before opening a e2e test PR, so we can properly keep track. I have added your current PRs, but please comment for future ones. Thanks! |
@YJDoc2 |
This implements the process validation in #361.