fix: ensure all report subcommands exit 0 when there is no app

Closes #7454
This commit is contained in:
Jose Diaz-Gonzalez
2025-02-02 01:37:14 -05:00
parent 8e88a3b54a
commit e1af6ad1f9
17 changed files with 128 additions and 6 deletions

View File

@@ -4,17 +4,18 @@ load test_helper
setup() {
global_setup
deploy_app
rm -f /tmp/fake-docker-bin
}
teardown() {
rm -f /tmp/fake-docker-bin
destroy_app
destroy_app || true
global_teardown
}
@test "(report) report" {
deploy_app
run /bin/bash -c "dokku report"
echo "output: $output"
echo "status: $status"
@@ -57,6 +58,8 @@ teardown() {
}
@test "(report) custom docker bin" {
deploy_app
export DOCKER_BIN="docker"
run /bin/bash -c "dokku report"
echo "output: $output"
@@ -85,3 +88,52 @@ teardown() {
unset DOCKER_BIN
}
@test "(report) exit 0 when no apps exist" {
run /bin/bash -c "dokku report"
echo "output: $output"
echo "status: $status"
assert_success
plugins=(
app-json
apps
builder
builder-dockerfile
builder-herokuish
builder-lambda
builder-nixpacks
builder-pack
buildpacks
caddy
certs
checks
cron
docker-options
domains
git
haproxy
logs
network
nginx
openresty
ports
proxy
ps
registry
resource
scheduler
scheduler-docker-local
scheduler-k3s
storage
traefik
)
for plugin in "${plugins[@]}"; do
run /bin/bash -c "dokku $plugin:report 2>&1"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "You haven't deployed any applications yet"
done
}