mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 07:48:55 +00:00
agent: fix unit tests - remove rustjail::errors
Fix unit tests and use `anyhow::Error`. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
6c96d66667
commit
8b07bc2c80
@ -203,6 +203,7 @@ fn get_container_pipe_size(param: &str) -> Result<i32> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use anyhow::Error;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::time;
|
||||
@ -223,7 +224,7 @@ mod tests {
|
||||
|
||||
// helper function to make errors less crazy-long
|
||||
fn make_err(desc: &str) -> Error {
|
||||
anyhow!(desc)
|
||||
anyhow!(desc.to_string())
|
||||
}
|
||||
|
||||
// Parameters:
|
||||
|
@ -470,7 +470,7 @@ mod tests {
|
||||
assert!(result.is_err());
|
||||
assert_eq!(
|
||||
result.unwrap_err().to_string(),
|
||||
"Error Code: 'no shell found to launch debug console'"
|
||||
"no shell found to launch debug console"
|
||||
);
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ mod tests {
|
||||
assert!(result.is_err());
|
||||
assert_eq!(
|
||||
result.unwrap_err().to_string(),
|
||||
"Error Code: 'no shell found to launch debug console'"
|
||||
"no shell found to launch debug console"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -350,6 +350,7 @@ mod tests {
|
||||
//use rustjail::Error;
|
||||
use super::Sandbox;
|
||||
use crate::{mount::BareMount, skip_if_not_root};
|
||||
use anyhow::Error;
|
||||
use nix::mount::MsFlags;
|
||||
use oci::{Linux, Root, Spec};
|
||||
use rustjail::container::LinuxContainer;
|
||||
@ -359,7 +360,7 @@ mod tests {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use tempfile::Builder;
|
||||
|
||||
fn bind_mount(src: &str, dst: &str, logger: &Logger) -> Result<(), rustjail::errors::Error> {
|
||||
fn bind_mount(src: &str, dst: &str, logger: &Logger) -> Result<(), Error> {
|
||||
let baremount = BareMount::new(src, dst, "bind", MsFlags::MS_BIND, "", &logger);
|
||||
baremount.mount()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user