diff --git a/tests/contest/contest/src/tests/kill/kill_test.rs b/tests/contest/contest/src/tests/kill/kill_test.rs index f033eb0a6..4ffcb31da 100644 --- a/tests/contest/contest/src/tests/kill/kill_test.rs +++ b/tests/contest/contest/src/tests/kill/kill_test.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use anyhow::{anyhow, Context, Result}; use oci_spec::runtime::{ProcessBuilder, Spec, SpecBuilder}; use test_framework::{Test, TestGroup, TestResult}; @@ -79,6 +81,7 @@ fn kill_stopped_container_test() -> TestResult { TestResult::Passed => {} _ => return TestResult::Failed(anyhow!("Failed to start container")), } + container.waiting_for_status(Duration::from_secs(10), Duration::from_secs(1), "stopped"); let result = match container.kill() { TestResult::Failed(_) => TestResult::Passed, TestResult::Passed => TestResult::Failed(anyhow!("Expected failure but got success")), @@ -105,6 +108,7 @@ fn kill_start_container_test() -> TestResult { } _ => unreachable!(), } + container.waiting_for_status(Duration::from_secs(10), Duration::from_secs(1), "running"); let result = container.kill(); container.delete(); result diff --git a/tests/contest/contest/src/tests/lifecycle/container_lifecycle.rs b/tests/contest/contest/src/tests/lifecycle/container_lifecycle.rs index d69653ada..c4cdcfd88 100644 --- a/tests/contest/contest/src/tests/lifecycle/container_lifecycle.rs +++ b/tests/contest/contest/src/tests/lifecycle/container_lifecycle.rs @@ -106,7 +106,7 @@ impl ContainerLifecycle { &self, retry_timeout: Duration, poll_interval: Duration, - target_status: String, + target_status: &str, ) -> TestResult { let start = Instant::now(); while start.elapsed() < retry_timeout { @@ -124,7 +124,7 @@ impl ContainerLifecycle { } sleep(poll_interval); } - return TestResult::Failed(anyhow!("error pod status is not update")); + TestResult::Failed(anyhow!("error pod status is not update")) } }