fix: deflake haproxy bats tests
The byjg/easy-haproxy image polls Docker for label changes every 10 seconds by default, which races with the haproxy bats suite and intermittently produces curl exit 7. Expose `refresh-conf` as a global-only haproxy property that maps to `EASYHAPROXY_REFRESH_CONF`, lower it to 2 seconds in the bats setup, and wrap the localhost HTTP assertions in a retry loop so checks wait for haproxy to converge rather than failing on the first attempt.
This commit is contained in:
7 files changed
+81
-13
No files matched your search
@@ -9,13 +9,14 @@ cmd-haproxy-set() {
|
||||
declare cmd="haproxy:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" KEY="$2" VALUE="$3"
|
||||
local VALID_KEYS=("image" "log-level" "letsencrypt-email" "letsencrypt-server")
|
||||
local GLOBAL_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" "refresh-conf")
|
||||
local GLOBAL_ONLY_KEYS=("refresh-conf")
|
||||
|
||||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
||||
|
||||
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
|
||||
|
||||
if ! fn-in-array "$KEY" "${GLOBAL_KEYS[@]}"; then
|
||||
@@ -25,6 +26,10 @@ cmd-haproxy-set() {
|
||||
verify_app_name "$APP"
|
||||
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
|
||||
dokku_log_info2_quiet "Setting ${KEY} to ${VALUE}"
|
||||
fn-plugin-property-write "haproxy" "$APP" "$KEY" "$VALUE"
|
||||
|
||||
Reference in new issue
Block a user