mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-05-04 04:00:07 +00:00
kata-deploy: remove useless unit tests
These essentially merely test format!(), which is not our job. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
@@ -85,85 +85,3 @@ pub async fn update_existing_runtimeclasses_for_nfd(config: &Config) -> Result<(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::config::NYDUS_FOR_KATA_TEE;
|
||||
|
||||
#[test]
|
||||
fn test_runtime_class_name_without_suffix() {
|
||||
// Test runtime class name without MULTI_INSTALL_SUFFIX
|
||||
let shim = "qemu";
|
||||
|
||||
// Expected: kata-qemu
|
||||
let expected = format!("kata-{}", shim);
|
||||
assert_eq!(expected, "kata-qemu");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_runtime_class_name_with_suffix() {
|
||||
// Test runtime class name with MULTI_INSTALL_SUFFIX
|
||||
let shim = "qemu";
|
||||
let suffix = Some("dev".to_string());
|
||||
|
||||
// Expected: kata-qemu-dev
|
||||
if let Some(s) = suffix {
|
||||
let expected = format!("kata-{}-{}", shim, s);
|
||||
assert_eq!(expected, "kata-qemu-dev");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_shims_with_suffix() {
|
||||
// Test different shims with suffix
|
||||
let shims = vec!["qemu", "qemu-tdx", "clh-runtime-rs", "fc"];
|
||||
let suffix = Some("staging".to_string());
|
||||
|
||||
for shim in shims {
|
||||
if let Some(ref s) = suffix {
|
||||
let runtime_class = format!("kata-{}-{}", shim, s);
|
||||
assert!(runtime_class.contains(shim));
|
||||
assert!(runtime_class.contains("staging"));
|
||||
assert!(runtime_class.starts_with("kata-"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_suffix_prevents_default_runtimeclass() {
|
||||
// When MULTI_INSTALL_SUFFIX is set, default runtime class should not be created
|
||||
// This test verifies the logic
|
||||
let suffix = Some("prod".to_string());
|
||||
let create_default = true;
|
||||
|
||||
// Logic: if suffix.is_some() && create_default, should warn and not create
|
||||
if suffix.is_some() && create_default {
|
||||
// Should not create default runtime class
|
||||
// Just verify the logic exists
|
||||
assert!(suffix.is_some());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_snapshotter_name_with_suffix() {
|
||||
// Test that the nydus snapshotter produces the nydus-for-kata-tee containerd plugin
|
||||
// name, with the suffix appended when MULTI_INSTALL_SUFFIX is set.
|
||||
let suffix = Some("dev".to_string());
|
||||
|
||||
if let Some(s) = suffix {
|
||||
let adjusted = format!("{NYDUS_FOR_KATA_TEE}-{}", s);
|
||||
assert_eq!(adjusted, format!("{NYDUS_FOR_KATA_TEE}-dev"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nydus_snapshotter_systemd_service_with_suffix() {
|
||||
// Test nydus-for-kata-tee systemd service name with suffix
|
||||
let suffix = Some("test".to_string());
|
||||
|
||||
if let Some(s) = suffix {
|
||||
let service_name = format!("{NYDUS_FOR_KATA_TEE}-{}", s);
|
||||
assert_eq!(service_name, format!("{NYDUS_FOR_KATA_TEE}-test"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user