这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/common/functions
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ docker_cleanup() {
declare desc="cleans up all exited/dead containers and removes all dangling images"
# delete all non-running containers
# shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
docker rm $(docker ps -a -f "status=exited" -f "label=$DOKKU_CONTAINER_LABEL" -q) &> /dev/null || true

# delete all dead containers
# shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=dead' -q) &> /dev/null || true
docker rm $(docker ps -a -f "status=dead" -f "label=$DOKKU_CONTAINER_LABEL" -q) &> /dev/null || true

# delete unused images
# shellcheck disable=SC2046
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/30_core_1.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,25 @@ build_nginx_config() {
echo "output: "$output
echo "status: "$status
assert_success

RANDOM_RUN_CID="$(docker run -d gliderlabs/herokuish bash)"
docker ps -a
run dokku cleanup
echo "output: "$output
echo "status: "$status
assert_success
sleep 5 # wait for dokku cleanup to happen in the background

docker ps -a
run bash -c "docker ps -a -f 'status=exited' --no-trunc=true | grep \"/exec echo $TEST_APP\""
echo "output: "$output
echo "status: "$status
assert_failure

run bash -c "docker inspect $RANDOM_RUN_CID"
echo "output: "$output
echo "status: "$status
assert_success
}

@test "(core) run (with DOKKU_RM_CONTAINER/--rm-container)" {
Expand Down