test: align triplet tests with actual plugin behavior
Fixes CI failures from the prior commit's bats additions. storage report mounts are prefixed with `-v `, logs.bats setup does not auto-create the test app, the nginx-vhosts shell report emits JSON keys without the `nginx-` plugin prefix, registry computed-image-repo falls back to the default `dokku/<app>` repo name when no template is set, cron computed-maintenance follows OR-not-override semantics so a per-app `false` does not override a global `true`, the scheduler subcommand help string is `Manage scheduler settings`, and bringing ps procfile-path into the #8640 raw convention required updating the pre-existing `(ps:set) procfile` assertion. Also extends fn-git-keep-git-dir to fall back through the global property before the built-in default so global keep-git-dir actually takes effect at deploy time.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <app> 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" {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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/<app> 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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user