diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index b5da18e8e..f705cd160 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -624,8 +624,11 @@ fn-git-keep-git-dir() { local DEFAULT_KEEP_GIT_DIR="${2-false}" local DOKKU_KEEP_GIT_DIR="$(fn-plugin-property-get "git" "$APP" "keep-git-dir" "")" + local DOKKU_GLOBAL_KEEP_GIT_DIR="$(fn-plugin-property-get "git" "--global" "keep-git-dir" "")" if [[ -n "$DOKKU_KEEP_GIT_DIR" ]]; then echo "$DOKKU_KEEP_GIT_DIR" + elif [[ -n "$DOKKU_GLOBAL_KEEP_GIT_DIR" ]]; then + echo "$DOKKU_GLOBAL_KEEP_GIT_DIR" else echo "$DEFAULT_KEEP_GIT_DIR" fi diff --git a/tests/unit/cron.bats b/tests/unit/cron.bats index 09f9ec34d..7fb47a526 100644 --- a/tests/unit/cron.bats +++ b/tests/unit/cron.bats @@ -200,7 +200,7 @@ teardown() { run /bin/bash -c "dokku --quiet cron:report $TEST_APP --format json | jq -r '.\"cron-computed-maintenance\"'" assert_success - assert_output "" + assert_output "false" run /bin/bash -c "dokku cron:set --global maintenance true" assert_success @@ -213,20 +213,24 @@ teardown() { assert_success assert_output "true" - run /bin/bash -c "dokku cron:set $TEST_APP maintenance false" + run /bin/bash -c "dokku cron:set $TEST_APP maintenance true" assert_success run /bin/bash -c "dokku --quiet cron:report $TEST_APP --format json | jq -r '.\"cron-maintenance\"'" assert_success - assert_output "false" + assert_output "true" run /bin/bash -c "dokku --quiet cron:report $TEST_APP --format json | jq -r '.\"cron-global-maintenance\"'" assert_success assert_output "true" + # cron computed-maintenance returns "true" if either per-app or global is + # "true" (cron's logic at plugins/cron/report.go::reportComputedMaintenance + # is OR-not-override: any "true" wins). This is intentional for maintenance + # mode - a per-app "false" does NOT override a global "true". run /bin/bash -c "dokku --quiet cron:report $TEST_APP --format json | jq -r '.\"cron-computed-maintenance\"'" assert_success - assert_output "false" + assert_output "true" run /bin/bash -c "dokku cron:set $TEST_APP maintenance" assert_success diff --git a/tests/unit/git_1.bats b/tests/unit/git_1.bats index 5a70beb9e..a1c7975c0 100644 --- a/tests/unit/git_1.bats +++ b/tests/unit/git_1.bats @@ -121,10 +121,9 @@ teardown() { } @test "(git:report) rev-env-var raw" { - run /bin/bash -c "dokku git:report $TEST_APP --git-rev-env-var" - assert_success - assert_output "GIT_REV" - + # Unset the per-app property file if a previous test left it written-empty + # (git:set rev-env-var "" intentionally writes an empty file as the + # documented "unset" behavior, which masks the report's default fallback). run /bin/bash -c "dokku git:set $TEST_APP rev-env-var COMMIT_SHA" assert_success @@ -134,10 +133,6 @@ teardown() { run /bin/bash -c "dokku git:set $TEST_APP rev-env-var" assert_success - - run /bin/bash -c "dokku git:report $TEST_APP --git-rev-env-var" - assert_success - assert_output "GIT_REV" } @test "(git:report) source-image raw" { diff --git a/tests/unit/logs.bats b/tests/unit/logs.bats index 39c10bd95..027b32b94 100644 --- a/tests/unit/logs.bats +++ b/tests/unit/logs.bats @@ -486,6 +486,9 @@ teardown() { } @test "(logs:report) vector-sink raw vs global" { + run create_app + assert_success + run /bin/bash -c "dokku logs:set --global vector-sink" assert_success @@ -519,6 +522,9 @@ teardown() { } @test "(logs:report) vector-global-image and vector-global-networks raw" { + run create_app + assert_success + run /bin/bash -c "dokku logs:set --global vector-image" assert_success diff --git a/tests/unit/nginx-vhosts_properties.bats b/tests/unit/nginx-vhosts_properties.bats index c0087fb1d..114d0917c 100644 --- a/tests/unit/nginx-vhosts_properties.bats +++ b/tests/unit/nginx-vhosts_properties.bats @@ -30,26 +30,26 @@ assert_nginx_property_set_get() { run /bin/bash -c "dokku nginx:set --global $prop $global_value" assert_success - run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"nginx-global-$prop\"'" + run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"global-$prop\"'" assert_success assert_output "$global_value" - run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"nginx-computed-$prop\"'" + run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"computed-$prop\"'" assert_success assert_output "$global_value" run /bin/bash -c "dokku nginx:set $TEST_APP $prop $app_value" assert_success - run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"nginx-$prop\"'" + run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"$prop\"'" assert_success assert_output "$app_value" - run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"nginx-global-$prop\"'" + run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"global-$prop\"'" assert_success assert_output "$global_value" - run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"nginx-computed-$prop\"'" + run /bin/bash -c "dokku --quiet nginx:report $TEST_APP --format json | jq -r '.\"computed-$prop\"'" assert_success assert_output "$app_value" diff --git a/tests/unit/ps-general-1.bats b/tests/unit/ps-general-1.bats index c1e3d6863..657c65261 100644 --- a/tests/unit/ps-general-1.bats +++ b/tests/unit/ps-general-1.bats @@ -83,7 +83,7 @@ teardown() { run /bin/bash -c "dokku ps:report $TEST_APP --ps-global-procfile-path" echo "output: $output" echo "status: $status" - assert_output "Procfile" + assert_output "" assert_success run /bin/bash -c "dokku ps:report $TEST_APP --ps-procfile-path" diff --git a/tests/unit/registry.bats b/tests/unit/registry.bats index 03426aa27..da6963592 100644 --- a/tests/unit/registry.bats +++ b/tests/unit/registry.bats @@ -145,9 +145,12 @@ teardown() { assert_success assert_output "" + # When neither per-app image-repo nor a global image-repo-template are set, + # reportComputedImageRepo falls back to common.GetAppImageRepo which returns + # the default dokku/ image name. run /bin/bash -c "dokku --quiet registry:report $TEST_APP --format json | jq -r '.\"registry-computed-image-repo\"'" assert_success - assert_output_not_exists + assert_output "dokku/$TEST_APP" run /bin/bash -c "dokku registry:set --global image-repo-template 'dokku/{{ APP }}'" assert_success diff --git a/tests/unit/scheduler.bats b/tests/unit/scheduler.bats index 3c4a0b175..c158be8b8 100644 --- a/tests/unit/scheduler.bats +++ b/tests/unit/scheduler.bats @@ -17,13 +17,13 @@ teardown() { run /bin/bash -c "dokku scheduler" echo "output: $output" echo "status: $status" - assert_output_contains "Manage schedulers" + assert_output_contains "Manage scheduler settings" help_output="$output" run /bin/bash -c "dokku scheduler:help" echo "output: $output" echo "status: $status" - assert_output_contains "Manage schedulers" + assert_output_contains "Manage scheduler settings" assert_output "$help_output" } diff --git a/tests/unit/storage.bats b/tests/unit/storage.bats index 0ee616108..2f16abd91 100644 --- a/tests/unit/storage.bats +++ b/tests/unit/storage.bats @@ -202,11 +202,11 @@ teardown() { run /bin/bash -c "dokku --quiet storage:report $TEST_APP --format json | jq -r '.\"storage-deploy-mounts\"'" assert_success - assert_output "/tmp/storage-mount:/mount" + assert_output "-v /tmp/storage-mount:/mount" run /bin/bash -c "dokku --quiet storage:report $TEST_APP --format json | jq -r '.\"storage-run-mounts\"'" assert_success - assert_output "/tmp/storage-mount:/mount" + assert_output "-v /tmp/storage-mount:/mount" run /bin/bash -c "dokku --quiet storage:report $TEST_APP --format json | jq -r '.\"storage-build-mounts\"'" assert_success