Merge pull request #8545 from dokku/haproxy-fails

Deflake haproxy bats tests
This commit is contained in:
Jose Diaz-Gonzalez authored and GitHub committed 2026-05-01 16:53:41 -04:00
commit 8497a1cc52
37 files changed
+349 -63

No files matched your search

+10
View File
@@ -113,6 +113,16 @@ dokku haproxy:set --global log-level DEBUG
After modifying, the Haproxy container will need to be restarted. After modifying, the Haproxy container will need to be restarted.
### Changing the Haproxy refresh interval
Haproxy polls the Docker API for label changes every `10` seconds by default. The interval may be changed by setting the `refresh-conf` property with the `--global` flag:
```shell
dokku haproxy:set --global refresh-conf 5
```
The `refresh-conf` property is global-only and cannot be set on a per-app basis. Setting an empty value will reset it to the default. After modifying, the Haproxy container will need to be restarted.
### Label Management ### Label Management
The Haproxy plugin allows you to add custom container labels to apps. These labels are injected into containers during deployment and can be used to configure Haproxy behavior beyond what the plugin provides by default. The Haproxy plugin allows you to add custom container labels to apps. These labels are injected into containers during deployment and can be used to configure Haproxy behavior beyond what the plugin provides by default.
@@ -12,13 +12,15 @@ cmd-builder-dockerfile-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -12,13 +12,15 @@ cmd-builder-herokuish-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -12,13 +12,15 @@ cmd-builder-lambda-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -12,13 +12,15 @@ cmd-builder-nixpacks-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -12,13 +12,15 @@ cmd-builder-pack-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -12,13 +12,15 @@ cmd-builder-railpack-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -37,13 +37,15 @@ cmd-caddy-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -12,13 +12,15 @@ cmd-certs-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -13,13 +13,15 @@ cmd-checks-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -5
View File
@@ -12,15 +12,15 @@ cmd-domains-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" != "--global" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ "$APP" == "--global" ]]; then
:
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -327,13 +327,15 @@ cmd-git-report() {
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+6 -3
View File
@@ -37,13 +37,15 @@ cmd-haproxy-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
@@ -72,6 +74,7 @@ cmd-haproxy-report-single() {
"--haproxy-letsencrypt-email: $(fn-haproxy-letsencrypt-email)" "--haproxy-letsencrypt-email: $(fn-haproxy-letsencrypt-email)"
"--haproxy-letsencrypt-server: $(fn-haproxy-letsencrypt-server)" "--haproxy-letsencrypt-server: $(fn-haproxy-letsencrypt-server)"
"--haproxy-log-level: $(fn-haproxy-log-level)" "--haproxy-log-level: $(fn-haproxy-log-level)"
"--haproxy-refresh-conf: $(fn-haproxy-refresh-conf)"
) )
fn-report-validate-format "$FORMAT" "$INFO_FLAG" fn-report-validate-format "$FORMAT" "$INFO_FLAG"
+6 -1
View File
@@ -38,7 +38,8 @@ fn-haproxy-template-compose-file() {
local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-image)" local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-image)"
HAPROXY_LOG_LEVEL="$(fn-haproxy-log-level)" HAPROXY_LOG_LEVEL="$(fn-haproxy-log-level)"
HAPROXY_LETSENCRYPT_EMAIL="$(fn-haproxy-letsencrypt-email)" HAPROXY_LETSENCRYPT_EMAIL="$(fn-haproxy-letsencrypt-email)"
HAPROXY_LETSENCRYPT_SERVER="$(fn-haproxy-letsencrypt-server)") HAPROXY_LETSENCRYPT_SERVER="$(fn-haproxy-letsencrypt-server)"
HAPROXY_REFRESH_CONF="$(fn-haproxy-refresh-conf)")
sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH" sigil -f "$COMPOSE_TEMPLATE" "${SIGIL_PARAMS[@]}" | cat -s >"$OUTPUT_PATH"
} }
@@ -60,3 +61,7 @@ fn-haproxy-letsencrypt-email() {
fn-haproxy-letsencrypt-server() { fn-haproxy-letsencrypt-server() {
fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory" fn-plugin-property-get-default "haproxy" "--global" "letsencrypt-server" "https://acme-v02.api.letsencrypt.org/directory"
} }
fn-haproxy-refresh-conf() {
fn-plugin-property-get-default "haproxy" "--global" "refresh-conf" "10"
}
+8 -3
View File
@@ -9,13 +9,14 @@ cmd-haproxy-set() {
declare cmd="haproxy:set" declare cmd="haproxy:set"
[[ "$1" == "$cmd" ]] && shift 1 [[ "$1" == "$cmd" ]] && shift 1
declare APP="$1" KEY="$2" VALUE="$3" declare APP="$1" KEY="$2" VALUE="$3"
local VALID_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server") local VALID_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server" "refresh-conf")
local GLOBAL_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server") local GLOBAL_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server" "refresh-conf")
local GLOBAL_ONLY_KEYS=("refresh-conf")
[[ -z "$KEY" ]] && dokku_log_fail "No key specified" [[ -z "$KEY" ]] && dokku_log_fail "No key specified"
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
dokku_log_fail "Invalid key specified, valid keys include: image log-level letsencrypt-email letsencrypt-server" dokku_log_fail "Invalid key specified, valid keys include: image log-level letsencrypt-email letsencrypt-server refresh-conf"
fi fi
if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then
@@ -25,6 +26,10 @@ cmd-haproxy-set() {
verify_app_name "$APP" verify_app_name "$APP"
fi fi
if fn-in-array "$KEY" "${GLOBAL_ONLY_KEYS[@]}" && [[ "$APP" != "--global" ]]; then
dokku_log_fail "The key '$KEY' can only be set globally"
fi
if [[ -n "$VALUE" ]]; then if [[ -n "$VALUE" ]]; then
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}" dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}"
fn-plugin-property-write "haproxy" "$APP" "$KEY" "$VALUE" fn-plugin-property-write "haproxy" "$APP" "$KEY" "$VALUE"
@@ -7,6 +7,7 @@ services:
- EASYHAPROXY_DISCOVER=docker - EASYHAPROXY_DISCOVER=docker
- EASYHAPROXY_LABEL_PREFIX=haproxy - EASYHAPROXY_LABEL_PREFIX=haproxy
- EASYHAPROXY_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }} - EASYHAPROXY_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }}
- EASYHAPROXY_REFRESH_CONF={{ $.HAPROXY_REFRESH_CONF }}
- CERTBOT_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }} - CERTBOT_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }}
- HAPROXY_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }} - HAPROXY_LOG_LEVEL={{ $.HAPROXY_LOG_LEVEL }}
{{ if $.HAPROXY_LETSENCRYPT_EMAIL }} {{ if $.HAPROXY_LETSENCRYPT_EMAIL }}
+5 -3
View File
@@ -15,13 +15,15 @@ cmd-nginx-report() {
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -37,13 +37,15 @@ cmd-openresty-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
@@ -13,13 +13,15 @@ cmd-scheduler-docker-local-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+5 -3
View File
@@ -37,13 +37,15 @@ cmd-traefik-report() {
set -- "${REPORT_ARGS[@]}" set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}" declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP" INFO_FLAG="$APP"
APP="" APP=""
fi fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true" INFO_FLAG="true"
fi fi
+6
View File
@@ -35,6 +35,12 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
assert_output_contains "global builder-dockerfile information" assert_output_contains "global builder-dockerfile information"
run /bin/bash -c "dokku builder-dockerfile:report --global --builder-dockerfile-global-dockerfile-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "Dockerfile"
} }
@test "(builder-dockerfile:set)" { @test "(builder-dockerfile:set)" {
+18
View File
@@ -10,6 +10,24 @@ teardown() {
destroy_app destroy_app
} }
@test "(builder-herokuish:report) --global --builder-herokuish-global-allowed" {
run /bin/bash -c "dokku builder-herokuish:set --global allowed false"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-herokuish:report --global --builder-herokuish-global-allowed"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "false"
run /bin/bash -c "dokku builder-herokuish:set --global allowed"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(builder-herouish:build .env)" { @test "(builder-herouish:build .env)" {
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
echo "output: $output" echo "output: $output"
+18
View File
@@ -10,6 +10,24 @@ teardown() {
destroy_app destroy_app
} }
@test "(builder-lambda:report) --global --builder-lambda-global-lambdayml-path" {
run /bin/bash -c "dokku builder-lambda:set --global lambdayml-path lambda.alt.yml"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-lambda:report --global --builder-lambda-global-lambdayml-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "lambda.alt.yml"
run /bin/bash -c "dokku builder-lambda:set --global lambdayml-path"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(builder-lambda:set)" { @test "(builder-lambda:set)" {
run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk" run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk"
echo "output: $output" echo "output: $output"
+18
View File
@@ -14,6 +14,24 @@ teardown() {
destroy_app destroy_app
} }
@test "(builder-nixpacks:report) --global --builder-nixpacks-global-nixpackstoml-path" {
run /bin/bash -c "dokku builder-nixpacks:set --global nixpackstoml-path nixpacks.alt.toml"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-nixpacks:report --global --builder-nixpacks-global-nixpackstoml-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "nixpacks.alt.toml"
run /bin/bash -c "dokku builder-nixpacks:set --global nixpackstoml-path"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(builder-nixpacks:set)" { @test "(builder-nixpacks:set)" {
run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk" run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk"
echo "output: $output" echo "output: $output"
+18
View File
@@ -16,6 +16,24 @@ teardown() {
global_teardown global_teardown
} }
@test "(builder-pack:report) --global --builder-pack-global-projecttoml-path" {
run /bin/bash -c "dokku builder-pack:set --global projecttoml-path project.alt.toml"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-pack:report --global --builder-pack-global-projecttoml-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "project.alt.toml"
run /bin/bash -c "dokku builder-pack:set --global projecttoml-path"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(builder-pack:set)" { @test "(builder-pack:set)" {
run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk" run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk"
echo "output: $output" echo "output: $output"
+18
View File
@@ -25,6 +25,24 @@ teardown() {
global_teardown global_teardown
} }
@test "(builder-railpack:report) --global --builder-railpack-global-railpackjson-path" {
run /bin/bash -c "dokku builder-railpack:set --global railpackjson-path railpack.alt.json"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku builder-railpack:report --global --builder-railpack-global-railpackjson-path"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "railpack.alt.json"
run /bin/bash -c "dokku builder-railpack:set --global railpackjson-path"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(builder-railpack:set)" { @test "(builder-railpack:set)" {
run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk" run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk"
echo "output: $output" echo "output: $output"
+18
View File
@@ -18,6 +18,24 @@ teardown() {
dokku nginx:start dokku nginx:start
} }
@test "(caddy:report) --global --caddy-log-level" {
run /bin/bash -c "dokku caddy:set --global log-level DEBUG"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku caddy:report --global --caddy-log-level"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "DEBUG"
run /bin/bash -c "dokku caddy:set --global log-level"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(caddy) caddy:help" { @test "(caddy) caddy:help" {
run /bin/bash -c "dokku caddy" run /bin/bash -c "dokku caddy"
echo "output: $output" echo "output: $output"
+6
View File
@@ -53,6 +53,12 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
assert_output_contains "global ssl information" assert_output_contains "global ssl information"
run /bin/bash -c "dokku certs:report --global --ssl-bogus"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "Invalid flag passed"
} }
@test "(certs) certs:add" { @test "(certs) certs:add" {
+6
View File
@@ -45,6 +45,12 @@ teardown() {
assert_success assert_success
assert_output_contains "global checks information" assert_output_contains "global checks information"
run /bin/bash -c "dokku checks:report --global --checks-global-wait-to-retire"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "90"
run /bin/bash -c "dokku checks:set --global wait-to-retire" run /bin/bash -c "dokku checks:set --global wait-to-retire"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
+6
View File
@@ -45,6 +45,12 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
assert_output_contains "Global domains information" assert_output_contains "Global domains information"
run /bin/bash -c "dokku domains:report --global --domains-global-enabled"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "true"
} }
@test "(domains) domains" { @test "(domains) domains" {
+6
View File
@@ -858,4 +858,10 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
assert_output "false" assert_output "false"
run /bin/bash -c "dokku git:report --global --git-global-deploy-branch"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "master"
} }
+39 -7
View File
@@ -7,6 +7,7 @@ setup() {
dokku nginx:stop dokku nginx:stop
dokku haproxy:set --global letsencrypt-server https://acme-staging-v02.api.letsencrypt.org/directory dokku haproxy:set --global letsencrypt-server https://acme-staging-v02.api.letsencrypt.org/directory
dokku haproxy:set --global letsencrypt-email dokku haproxy:set --global letsencrypt-email
dokku haproxy:set --global refresh-conf 2
dokku haproxy:start dokku haproxy:start
create_app create_app
} }
@@ -15,6 +16,7 @@ teardown() {
global_teardown global_teardown
destroy_app destroy_app
dokku haproxy:stop dokku haproxy:stop
dokku haproxy:set --global refresh-conf
dokku nginx:start dokku nginx:start
} }
@@ -32,6 +34,42 @@ teardown() {
assert_output "$help_output" assert_output "$help_output"
} }
@test "(haproxy) refresh-conf" {
run /bin/bash -c "dokku haproxy:set $TEST_APP refresh-conf 2"
echo "output: $output"
echo "status: $status"
assert_failure
assert_output_contains "can only be set globally"
run /bin/bash -c "dokku haproxy:set --global refresh-conf 5"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku haproxy:report --global --haproxy-refresh-conf"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "5"
run /bin/bash -c "dokku haproxy:show-config"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "EASYHAPROXY_REFRESH_CONF=5"
run /bin/bash -c "dokku haproxy:set --global refresh-conf"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku haproxy:report --global --haproxy-refresh-conf"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "10"
}
@test "(haproxy) log-level" { @test "(haproxy) log-level" {
run /bin/bash -c "dokku haproxy:set --global log-level DEBUG" run /bin/bash -c "dokku haproxy:set --global log-level DEBUG"
echo "output: $output" echo "output: $output"
@@ -60,11 +98,7 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
run /bin/bash -c "curl --silent $(dokku url $TEST_APP)" assert_http_localhost_response_contains "http" "$TEST_APP.$DOKKU_DOMAIN" "80" "/" "python/http.server"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "python/http.server"
} }
@test "(haproxy) multiple domains" { @test "(haproxy) multiple domains" {
@@ -88,8 +122,6 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
sleep 5
run /bin/bash -c "dokku logs $TEST_APP" run /bin/bash -c "dokku logs $TEST_APP"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
+16
View File
@@ -79,6 +79,22 @@ teardown() {
echo "status: $status" echo "status: $status"
assert_success assert_success
assert_output_contains "global nginx information" assert_output_contains "global nginx information"
run /bin/bash -c "dokku nginx:set --global client-max-body-size 5m"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku nginx:report --global --nginx-global-client-max-body-size"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "5m"
run /bin/bash -c "dokku nginx:set --global client-max-body-size"
echo "output: $output"
echo "status: $status"
assert_success
} }
@test "(nginx-vhosts) proxy:build-config (domains:disable/enable)" { @test "(nginx-vhosts) proxy:build-config (domains:disable/enable)" {
+8
View File
@@ -18,6 +18,14 @@ teardown() {
dokku nginx:start dokku nginx:start
} }
@test "(openresty:report) --global --openresty-letsencrypt-server" {
run /bin/bash -c "dokku openresty:report --global --openresty-letsencrypt-server"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "https://acme-staging-v02.api.letsencrypt.org/directory"
}
@test "(openresty) openresty:help" { @test "(openresty) openresty:help" {
run /bin/bash -c "dokku openresty" run /bin/bash -c "dokku openresty"
echo "output: $output" echo "output: $output"
+8
View File
@@ -10,6 +10,14 @@ teardown() {
global_teardown global_teardown
} }
@test "(scheduler-docker-local:report) --global --scheduler-docker-local-init-process" {
run /bin/bash -c "dokku scheduler-docker-local:report --global --scheduler-docker-local-init-process"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "true"
}
@test "(scheduler-docker-local) scheduler-docker-local:help" { @test "(scheduler-docker-local) scheduler-docker-local:help" {
run /bin/bash -c "dokku scheduler-docker-local" run /bin/bash -c "dokku scheduler-docker-local"
echo "output: $output" echo "output: $output"
+16 -2
View File
@@ -249,10 +249,17 @@ assert_http_success() {
assert_http_localhost_response() { assert_http_localhost_response() {
local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}" content="${5:-}" status_code="${6:-200}" local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}" content="${5:-}" status_code="${6:-200}"
run curl --connect-to "$domain:$port:localhost:$port" -kSso /dev/null -w "%{http_code}" "$scheme://$domain:$port$path" local retries="${HTTP_ASSERT_RETRIES:-30}" attempt=1
while [[ "$attempt" -lt "$retries" ]]; do
run curl --connect-to "$domain:$port:localhost:$port" -kSso /dev/null -w "%{http_code}" "$scheme://$domain:$port$path"
[[ "$output" == "$status_code" ]] && break
sleep 1
attempt=$((attempt + 1))
done
echo "curl: curl --connect-to $domain:$port:localhost:$port -kSso /dev/null -w %{http_code} $scheme://$domain:$port$path" echo "curl: curl --connect-to $domain:$port:localhost:$port -kSso /dev/null -w %{http_code} $scheme://$domain:$port$path"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
echo "attempts: $attempt"
assert_output "$status_code" assert_output "$status_code"
if [[ -n "$content" ]]; then if [[ -n "$content" ]]; then
@@ -265,10 +272,17 @@ assert_http_localhost_response() {
assert_http_localhost_response_contains() { assert_http_localhost_response_contains() {
local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}" content="${5:-}" status_code="${6:-200}" local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}" content="${5:-}" status_code="${6:-200}"
run curl --connect-to "$domain:$port:localhost:$port" -kSso /dev/null -w "%{http_code}" "$scheme://$domain:$port$path" local retries="${HTTP_ASSERT_RETRIES:-30}" attempt=1
while [[ "$attempt" -lt "$retries" ]]; do
run curl --connect-to "$domain:$port:localhost:$port" -kSso /dev/null -w "%{http_code}" "$scheme://$domain:$port$path"
[[ "$output" == "$status_code" ]] && break
sleep 1
attempt=$((attempt + 1))
done
echo "curl: curl --connect-to $domain:$port:localhost:$port -kSso /dev/null -w %{http_code} $scheme://$domain:$port$path" echo "curl: curl --connect-to $domain:$port:localhost:$port -kSso /dev/null -w %{http_code} $scheme://$domain:$port$path"
echo "output: $output" echo "output: $output"
echo "status: $status" echo "status: $status"
echo "attempts: $attempt"
assert_output "$status_code" assert_output "$status_code"
if [[ -n "$content" ]]; then if [[ -n "$content" ]]; then
+18
View File
@@ -23,6 +23,24 @@ teardown() {
dokku nginx:start dokku nginx:start
} }
@test "(traefik:report) --global --traefik-log-level" {
run /bin/bash -c "dokku traefik:set --global log-level DEBUG"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku traefik:report --global --traefik-log-level"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "DEBUG"
run /bin/bash -c "dokku traefik:set --global log-level"
echo "output: $output"
echo "status: $status"
assert_success
}
@test "(traefik) traefik:help" { @test "(traefik) traefik:help" {
run /bin/bash -c "dokku traefik" run /bin/bash -c "dokku traefik"
echo "output: $output" echo "output: $output"