diff --git a/src/tools/kata-ctl/Cargo.toml b/src/tools/kata-ctl/Cargo.toml index cc32054d29..d1f3c5637c 100644 --- a/src/tools/kata-ctl/Cargo.toml +++ b/src/tools/kata-ctl/Cargo.toml @@ -30,6 +30,7 @@ shim-interface = { path = "../../libs/shim-interface"} kata-types = { path = "../../libs/kata-types" } safe-path = { path = "../../libs/safe-path" } agent = { path = "../../runtime-rs/crates/agent"} +serial_test = "0.5.1" [target.'cfg(target_arch = "s390x")'.dependencies] reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "native-tls"] } diff --git a/src/tools/kata-ctl/src/ops/volume_ops.rs b/src/tools/kata-ctl/src/ops/volume_ops.rs index a9df9ce78d..60c753f6f6 100644 --- a/src/tools/kata-ctl/src/ops/volume_ops.rs +++ b/src/tools/kata-ctl/src/ops/volume_ops.rs @@ -169,11 +169,13 @@ pub fn get_sandbox_id_for_volume(volume_path: &str) -> Result { mod tests { use super::*; use kata_types::mount::DirectVolumeMountInfo; + use serial_test::serial; use std::{collections::HashMap, fs}; use tempfile::tempdir; use test_utils::skip_if_not_root; #[test] + #[serial] fn test_get_sandbox_id_for_volume() { // this test has to run as root, so has to manually cleanup afterwards skip_if_not_root!(); @@ -259,6 +261,7 @@ mod tests { } #[test] + #[serial] fn test_add_remove() { skip_if_not_root!(); // example volume dir is a/b/c, note the behavior of join would take "/a" as absolute path. diff --git a/src/tools/kata-ctl/src/utils.rs b/src/tools/kata-ctl/src/utils.rs index b1564f4c47..8e6815d02a 100644 --- a/src/tools/kata-ctl/src/utils.rs +++ b/src/tools/kata-ctl/src/utils.rs @@ -147,10 +147,12 @@ pub fn get_generic_cpu_details(cpu_info_file: &str) -> Result<(String, String)> #[cfg(test)] mod tests { use super::*; + use serial_test::serial; use std::io::Write; use tempfile::tempdir; #[test] + #[serial] fn test_drop_privs() { let res = drop_privs(); assert!(res.is_ok()); @@ -164,6 +166,7 @@ mod tests { } #[test] + #[serial] fn test_kernel_version_valid_input() { let dir = tempdir().unwrap(); let file_path = dir.path().join("proc-version"); @@ -208,6 +211,7 @@ mod tests { } #[test] + #[serial] fn test_get_distro_details_valid_file() { let dir = tempdir().unwrap(); let file_path = dir.path().join("os-version");