1
0
mirror of https://github.com/containers/youki synced 2024-11-23 17:32:15 +01:00

modify current two cases into more simple

This commit is contained in:
tommady 2021-10-09 07:45:26 +00:00
parent f1acccb654
commit dd909af77a
No known key found for this signature in database
GPG Key ID: 15E4E2B7957CF963

@ -199,33 +199,33 @@ impl Container {
#[cfg(test)]
mod tests {
use std::env;
use super::*;
use anyhow::Result;
#[test]
fn test_set_id() -> Result<()> {
let dir = env::temp_dir();
let mut container =
Container::new("container_id", ContainerStatus::Created, None, &dir, &dir)?;
fn test_get_set_pid() {
let mut container = Container::default();
assert_eq!(container.pid(), None);
container.set_pid(1);
assert_eq!(container.pid(), Some(Pid::from_raw(1)));
Ok(())
}
#[test]
fn test_basic_getter() -> Result<()> {
fn test_container_id_and_bundle_root_paths() {
let container = Container::new(
"container_id",
"container_id_for_testing",
ContainerStatus::Created,
None,
&PathBuf::from("."),
&PathBuf::from("."),
)?;
)
.unwrap();
assert_eq!(container.id(), "container_id_for_testing");
assert_eq!(container.bundle(), &PathBuf::from("."));
assert_eq!(container.root, fs::canonicalize(PathBuf::from("."))?);
Ok(())
assert_eq!(
container.root,
fs::canonicalize(PathBuf::from(".")).unwrap()
);
}
}