Skip to content

Commit

Permalink
tests: functional: check delete fails without kill
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jcvenegas committed Jun 28, 2017
1 parent a51537c commit 29f8aa2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/functional/kill.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 29f8aa2

Please sign in to comment.