mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-31 07:19:06 +00:00
Merge pull request #11345 from Apokleos/fix-noise
protocols: Fix the noise caused by non-formatted codes in protocols
This commit is contained in:
commit
7916db9613
@ -9,6 +9,7 @@ pub mod agent;
|
||||
pub mod agent_ttrpc;
|
||||
#[cfg(feature = "async")]
|
||||
pub mod agent_ttrpc_async;
|
||||
pub mod api;
|
||||
pub mod csi;
|
||||
pub mod empty;
|
||||
mod gogo;
|
||||
@ -17,15 +18,14 @@ pub mod health_ttrpc;
|
||||
#[cfg(feature = "async")]
|
||||
pub mod health_ttrpc_async;
|
||||
pub mod oci;
|
||||
#[cfg(feature = "with-serde")]
|
||||
mod serde_config;
|
||||
pub mod trans;
|
||||
pub mod types;
|
||||
pub mod remote;
|
||||
pub mod remote_ttrpc;
|
||||
#[cfg(feature = "async")]
|
||||
pub mod remote_ttrpc_async;
|
||||
pub mod api;
|
||||
#[cfg(feature = "with-serde")]
|
||||
mod serde_config;
|
||||
pub mod trans;
|
||||
pub mod types;
|
||||
|
||||
#[cfg(feature = "with-serde")]
|
||||
pub use serde_config::{
|
||||
|
@ -42,7 +42,9 @@ fn cap_vec2hashset(caps: Vec<String>) -> HashSet<oci::Capability> {
|
||||
.map(|cap: &String| {
|
||||
// cap might be JSON-encoded
|
||||
let decoded: &str = serde_json::from_str(cap).unwrap_or(cap);
|
||||
decoded.strip_prefix("CAP_").unwrap_or(decoded)
|
||||
decoded
|
||||
.strip_prefix("CAP_")
|
||||
.unwrap_or(decoded)
|
||||
.parse::<oci::Capability>()
|
||||
.unwrap_or_else(|_| panic!("Failed to parse {:?} to Enum Capability", cap))
|
||||
})
|
||||
@ -1318,8 +1320,6 @@ mod tests {
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_cap_vec2hashset_bad() {
|
||||
cap_vec2hashset(vec![
|
||||
"CAP_DOES_NOT_EXIST".to_string(),
|
||||
]);
|
||||
cap_vec2hashset(vec!["CAP_DOES_NOT_EXIST".to_string()]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user