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:
Jose Diaz-Gonzalez
2026-04-30 15:03:40 -04:00
parent 8f8a23aac3
commit 53ef8c7780
7 changed files with 81 additions and 13 deletions

View File

@@ -38,7 +38,8 @@ fn-haproxy-template-compose-file() {
local SIGIL_PARAMS=(HAPROXY_IMAGE="$(fn-haproxy-image)"
HAPROXY_LOG_LEVEL="$(fn-haproxy-log-level)"
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"
}
@@ -60,3 +61,7 @@ fn-haproxy-letsencrypt-email() {
fn-haproxy-letsencrypt-server() {
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"
}