Skip to content

Commit f8c3e5c

Browse files
author
Toby Bellwood
committed
chore: additional test fixups for bufsize
1 parent 742492c commit f8c3e5c

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

haproxy.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ defaults
1111
timeout server 60s
1212

1313
frontend http
14-
bind :80
14+
bind :80

haproxy.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
server {{ .Address.IP }}:{{ .Address.Port }} {{ .Address.IP }}:{{ .Address.Port }} check
77
{{ else }}
88
# {{ .Container.Name }}
9-
server {{ .Container.Name }}:{{ .Address.Port }} {{ .Container.Name }}:{{ .Address.Port }} check
9+
server {{ .Container.Name }}:{{ .Address.Port }} {{ .Container.Name }}:{{ .Address.Port }} check init-addr none
1010
{{ end }}
1111
{{ end }}
1212
{{ end }}

tests/runtime.bats

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ _require_docker_socket() {
154154
[[ "$output" =~ "class=px" ]]
155155
}
156156

157+
@test "tune.bufsize allows request headers larger than the default 16 KB" {
158+
_require_docker_socket
159+
# Send a header value between the default tune.bufsize (16384) and the
160+
# configured value (32768). With the default bufsize HAProxy would drop the
161+
# connection (curl gets "000"); with the configured 32768 it fits and HAProxy
162+
# serves the stats page with a 200. Asserting exactly 200 catches both cases.
163+
local large_value
164+
large_value="$(python3 -c 'print("A" * 30000)')"
165+
run curl -s -o /dev/null -w "%{http_code}" \
166+
-H "X-Large-Header: ${large_value}" \
167+
"http://localhost:${TEST_PORT}/stats"
168+
[ "$status" -eq 0 ]
169+
[ "$output" = "200" ]
170+
}
171+
157172
# ---------------------------------------------------------------------------
158173
# Integration — backend containers appear in the generated haproxy config.
159174
# These tests mirror the "mailhog test" / backend discovery steps in CI.

0 commit comments

Comments
 (0)