From dd909af77af66493e12ed6a29b81656dcaecc394 Mon Sep 17 00:00:00 2001 From: tommady Date: Sat, 9 Oct 2021 07:45:26 +0000 Subject: [PATCH] modify current two cases into more simple --- src/container/container.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/container/container.rs b/src/container/container.rs index 78247884..f44544d3 100644 --- a/src/container/container.rs +++ b/src/container/container.rs @@ -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() + ); } }