mirror of
https://github.com/containers/youki
synced 2024-11-22 17:02:00 +01:00
Re enable skipped e2e tests (#2647)
* Add env var check for e2e tests not supported by runc Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com> * use nix to get domain name * Extract the runc check into a function Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com> --------- Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
This commit is contained in:
parent
220451e4ed
commit
53adffe43a
4
justfile
4
justfile
@ -55,11 +55,11 @@ test-oci:
|
||||
|
||||
# run rust oci integration tests
|
||||
test-contest: youki-release contest
|
||||
{{ cwd }}/scripts/contest.sh {{ cwd }}/youki
|
||||
sudo {{ cwd }}/scripts/contest.sh {{ cwd }}/youki
|
||||
|
||||
# validate rust oci integration tests on runc
|
||||
validate-contest-runc: contest
|
||||
{{ cwd }}/scripts/contest.sh runc
|
||||
sudo RUNTIME_KIND="runc" {{ cwd }}/scripts/contest.sh runc
|
||||
|
||||
# test podman rootless works with youki
|
||||
test-rootless-podman:
|
||||
|
@ -24,7 +24,7 @@ if [ ! -f ${ROOT}/bundle.tar.gz ]; then
|
||||
fi
|
||||
touch ${LOGFILE}
|
||||
|
||||
sudo ${ROOT}/contest run --runtime "$RUNTIME" --runtimetest ${ROOT}/runtimetest > $LOGFILE
|
||||
${ROOT}/contest run --runtime "$RUNTIME" --runtimetest ${ROOT}/runtimetest > $LOGFILE
|
||||
|
||||
if [ 0 -ne $(grep "not ok" $LOGFILE | wc -l ) ]; then
|
||||
cat $LOGFILE
|
||||
|
@ -103,11 +103,9 @@ fn main() -> Result<()> {
|
||||
let ro_paths = get_ro_paths_test();
|
||||
let hostname = get_hostname_test();
|
||||
let mounts_recursive = get_mounts_recursive_test();
|
||||
#[allow(unused_variables)]
|
||||
let domainname = get_domainname_tests();
|
||||
let intel_rdt = get_intel_rdt_test();
|
||||
let sysctl = get_sysctl_test();
|
||||
#[allow(unused_variables)]
|
||||
let scheduler = get_scheduler_test();
|
||||
|
||||
tm.add_test_group(Box::new(cl));
|
||||
@ -127,10 +125,10 @@ fn main() -> Result<()> {
|
||||
tm.add_test_group(Box::new(ro_paths));
|
||||
tm.add_test_group(Box::new(hostname));
|
||||
tm.add_test_group(Box::new(mounts_recursive));
|
||||
// tm.add_test_group(Box::new(domainname)); // TODO (YJDoc2) fix in #2616
|
||||
tm.add_test_group(Box::new(domainname));
|
||||
tm.add_test_group(Box::new(intel_rdt));
|
||||
tm.add_test_group(Box::new(sysctl));
|
||||
// tm.add_test_group(Box::new(scheduler));
|
||||
tm.add_test_group(Box::new(scheduler));
|
||||
|
||||
tm.add_cleanup(Box::new(cgroups::cleanup_v1));
|
||||
tm.add_cleanup(Box::new(cgroups::cleanup_v2));
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::utils::test_inside_container;
|
||||
use crate::utils::{is_runtime_runc, test_inside_container};
|
||||
use oci_spec::runtime::{ProcessBuilder, Spec, SpecBuilder};
|
||||
use test_framework::{Test, TestGroup, TestResult};
|
||||
use test_framework::{ConditionalTest, TestGroup, TestResult};
|
||||
|
||||
fn get_spec(domainname: &str) -> Spec {
|
||||
SpecBuilder::default()
|
||||
@ -25,7 +25,11 @@ fn set_domainname_test() -> TestResult {
|
||||
|
||||
pub fn get_domainname_tests() -> TestGroup {
|
||||
let mut tg = TestGroup::new("domainname_test");
|
||||
let set_domainname_test = Test::new("set_domainname_test", Box::new(set_domainname_test));
|
||||
let set_domainname_test = ConditionalTest::new(
|
||||
"set_domainname_test",
|
||||
Box::new(|| !is_runtime_runc()),
|
||||
Box::new(set_domainname_test),
|
||||
);
|
||||
tg.add(vec![Box::new(set_domainname_test)]);
|
||||
|
||||
tg
|
||||
|
@ -2,9 +2,9 @@ use anyhow::{Context, Result};
|
||||
use oci_spec::runtime::{
|
||||
LinuxSchedulerPolicy, ProcessBuilder, SchedulerBuilder, Spec, SpecBuilder,
|
||||
};
|
||||
use test_framework::{test_result, Test, TestGroup, TestResult};
|
||||
use test_framework::{test_result, ConditionalTest, TestGroup, TestResult};
|
||||
|
||||
use crate::utils::test_inside_container;
|
||||
use crate::utils::{is_runtime_runc, test_inside_container};
|
||||
|
||||
fn create_spec(policy: LinuxSchedulerPolicy, execute_test: &str) -> Result<Spec> {
|
||||
let sc = SchedulerBuilder::default()
|
||||
@ -46,11 +46,17 @@ fn scheduler_policy_batch_test() -> TestResult {
|
||||
|
||||
pub fn get_scheduler_test() -> TestGroup {
|
||||
let mut scheduler_policy_group = TestGroup::new("set_scheduler_policy");
|
||||
let policy_fifo_test = Test::new("policy_other", Box::new(scheduler_policy_other_test));
|
||||
let policy_rr_test = Test::new("policy_batch", Box::new(scheduler_policy_batch_test));
|
||||
|
||||
scheduler_policy_group.add(vec![Box::new(policy_fifo_test)]);
|
||||
scheduler_policy_group.add(vec![Box::new(policy_rr_test)]);
|
||||
let policy_fifo_test = ConditionalTest::new(
|
||||
"policy_other",
|
||||
Box::new(|| !is_runtime_runc()),
|
||||
Box::new(scheduler_policy_other_test),
|
||||
);
|
||||
let policy_rr_test = ConditionalTest::new(
|
||||
"policy_batch",
|
||||
Box::new(|| !is_runtime_runc()),
|
||||
Box::new(scheduler_policy_batch_test),
|
||||
);
|
||||
|
||||
scheduler_policy_group.add(vec![Box::new(policy_fifo_test), Box::new(policy_rr_test)]);
|
||||
scheduler_policy_group
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
pub mod support;
|
||||
pub mod test_utils;
|
||||
pub use support::{
|
||||
generate_uuid, get_project_path, get_runtime_path, get_runtimetest_path, prepare_bundle,
|
||||
set_config, set_runtime_path,
|
||||
generate_uuid, get_project_path, get_runtime_path, get_runtimetest_path, is_runtime_runc,
|
||||
prepare_bundle, set_config, set_runtime_path,
|
||||
};
|
||||
pub use test_utils::{
|
||||
create_container, delete_container, get_state, kill_container, test_inside_container,
|
||||
|
@ -91,3 +91,10 @@ pub fn set_config<P: AsRef<Path>>(project_path: P, config: &Spec) -> Result<()>
|
||||
config.save(path)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn is_runtime_runc() -> bool {
|
||||
match std::env::var("RUNTIME_KIND") {
|
||||
Err(_) => false,
|
||||
Ok(s) => s == "runc",
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
use crate::utils::{self, test_read_access, test_write_access};
|
||||
use anyhow::{bail, Result};
|
||||
use libc::getdomainname;
|
||||
use nix::errno::Errno;
|
||||
use nix::unistd::getcwd;
|
||||
use nix::{errno::Errno, sys::utsname, unistd::getcwd};
|
||||
use oci_spec::runtime::{LinuxSchedulerPolicy, Spec};
|
||||
use std::ffi::CStr;
|
||||
use std::fs::{self, read_dir};
|
||||
use std::mem;
|
||||
use std::path::Path;
|
||||
@ -90,23 +87,13 @@ pub fn validate_domainname(spec: &Spec) {
|
||||
return;
|
||||
}
|
||||
|
||||
const MAX_DOMAINNAME_SIZE: usize = 254;
|
||||
let actual_domainname: [i8; MAX_DOMAINNAME_SIZE] = [0; MAX_DOMAINNAME_SIZE];
|
||||
|
||||
// TODO (YJDoc2) : libc now has support for getdomainname, update this to use that
|
||||
let ret =
|
||||
unsafe { getdomainname(actual_domainname.as_ptr() as *mut i8, MAX_DOMAINNAME_SIZE) };
|
||||
if ret == -1 {
|
||||
eprintln!("Failed to get domainname");
|
||||
}
|
||||
|
||||
let actual_domainname_cstr =
|
||||
unsafe { CStr::from_ptr(actual_domainname.as_ptr() as *mut i8) };
|
||||
if actual_domainname_cstr.to_str().unwrap() != expected_domainname {
|
||||
let uname_info = utsname::uname().unwrap();
|
||||
let actual_domainname = uname_info.domainname();
|
||||
if actual_domainname.to_str().unwrap() != expected_domainname {
|
||||
eprintln!(
|
||||
"Unexpected domainname, expected: {:?} found: {:?}",
|
||||
expected_domainname,
|
||||
actual_domainname_cstr.to_str().unwrap()
|
||||
actual_domainname.to_str().unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user