kata-types: parse single_container OCI container type

ContainerType already renders as "single_container" via Display, but
from_str rejected it. Accept it so the value can round-trip, matching
the container type the Go runtime uses for standalone containers.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
Assisted-by: Cursor <noreply@cursor.com>
This commit is contained in:
Fabiano Fidêncio
2026-05-31 19:20:11 +02:00
parent 023c25838e
commit 898ed869d2

View File

@@ -81,6 +81,7 @@ impl FromStr for ContainerType {
match value {
POD_CONTAINER | CONTAINER => Ok(ContainerType::PodContainer),
POD_SANDBOX | PODSANDBOX | SANDBOX => Ok(ContainerType::PodSandbox),
SINGLE_CONTAINER => Ok(ContainerType::SingleContainer),
_ => Err(Error::InvalidContainerType(value.to_owned())),
}
}
@@ -230,6 +231,10 @@ mod tests {
ContainerType::from_str("sandbox").unwrap(),
ContainerType::PodSandbox
);
assert_eq!(
ContainerType::from_str("single_container").unwrap(),
ContainerType::SingleContainer
);
ContainerType::from_str("test").unwrap_err();
}