From 29f8aa268138172e214d7780aa9dab47bf859558 Mon Sep 17 00:00:00 2001 From: Jose Carlos Venegas Munoz Date: Tue, 27 Jun 2017 22:59:41 +0000 Subject: [PATCH] tests: functional: check delete fails without kill This patch adds a negative tests: It will try to delete a running container. Delete must fail if the container is stopped state. Signed-off-by: Jose Carlos Venegas Munoz --- tests/functional/kill.bats | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/functional/kill.bats b/tests/functional/kill.bats index b94a3620..97de8b1d 100644 --- a/tests/functional/kill.bats +++ b/tests/functional/kill.bats @@ -153,3 +153,24 @@ function teardown() { rm -f "${ROOTFS_DIR}/${trap_file}" } + +@test "start and delete without kill" { + workload_cmd "sh" + + cmd="$COR run -d --bundle $BUNDLE_DIR $container_id" + run_cmd "$cmd" "0" "$COR_TIMEOUT" + testcontainer "$container_id" "running" + + #delete without stop container MUST fail + cmd="$COR delete $container_id" + run_cmd "$cmd" "1" "$COR_TIMEOUT" + verify_runtime_dirs "$container_id" "running" + + cmd="$COR kill $container_id TERM" + run_cmd "$cmd" "0" "$COR_TIMEOUT" + testcontainer "$container_id" "killed" + + cmd="$COR delete $container_id" + run_cmd "$cmd" "0" "$COR_TIMEOUT" + verify_runtime_dirs "$container_id" "deleted" +}