mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-10 07:05:51 +00:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user