mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
REGTESTS: update http_reuse_be_transparent with "transparent" deprecated
With commit e93f3ea3f8 ("MEDIUM: proxy: deprecate the "transparent" and "option transparent" directives") this one no longer works as the config either has to be adjusted to use server 0.0.0.0 or to enable the deprecated feature. The test used to validate a technical limitation ("transparent" not supporting shared connections), indicated as being comparable to "http-reuse never". Let's now duplicate the test for "http-reuse never" and "http-reuse always" and validate both behaviors. Take this opportunity to fix a few problems in this config: - use "nbthread 1": depending on the thread where the connection arrives, the connection may or may not be reused - add explicit URLs to the clients so that they can be recognized in the logs - add comments to make it clearer what to expect for each test
This commit is contained in:
parent
e93f3ea3f8
commit
1d3ab10423
@ -1,27 +1,41 @@
|
|||||||
varnishtest "Test the proper interaction between http-reuse and backend in transparent mode"
|
varnishtest "Test the proper interaction between http-reuse and backend in transparent mode"
|
||||||
feature cmd "$HAPROXY_PROGRAM -cc 'feature(TPROXY)'"
|
feature cmd "$HAPROXY_PROGRAM -cc 'feature(TPROXY)'"
|
||||||
|
|
||||||
# If backend is used with the transparent mode, the connection are considered
|
# Verify that connections made to a backend in transparent mode with
|
||||||
# as private and should only be reused for requests of the same session.
|
# "http-reuse never" are only reused with that client, and those with
|
||||||
# This is similar to the http-reuse never mode
|
# "http-reuse always" are properly shared across subsequent clients.
|
||||||
|
|
||||||
feature ignore_unknown_macro
|
feature ignore_unknown_macro
|
||||||
|
|
||||||
haproxy h1 -conf {
|
haproxy h1 -conf {
|
||||||
|
global
|
||||||
|
nbthread 1
|
||||||
|
|
||||||
defaults
|
defaults
|
||||||
timeout client 30s
|
timeout client 30s
|
||||||
timeout server 30s
|
timeout server 30s
|
||||||
timeout connect 30s
|
timeout connect 30s
|
||||||
mode http
|
mode http
|
||||||
|
|
||||||
listen sender
|
listen never
|
||||||
bind "fd@${feS}"
|
bind "fd@${feN}"
|
||||||
option transparent
|
http-reuse never
|
||||||
|
|
||||||
http-request set-dst hdr(dst)
|
http-request set-dst hdr(dst)
|
||||||
http-request set-dst-port hdr(dst-port)
|
http-request set-dst-port hdr(dst-port)
|
||||||
|
|
||||||
http-after-response set-header http_reuse %[bc_reused]
|
http-after-response set-header http_reuse %[bc_reused]
|
||||||
|
server transparent 0.0.0.0
|
||||||
|
|
||||||
|
listen always
|
||||||
|
bind "fd@${feA}"
|
||||||
|
http-reuse always
|
||||||
|
|
||||||
|
http-request set-dst hdr(dst)
|
||||||
|
http-request set-dst-port hdr(dst-port)
|
||||||
|
|
||||||
|
http-after-response set-header http_reuse %[bc_reused]
|
||||||
|
server transparent 0.0.0.0 pool-max-conn 10
|
||||||
|
|
||||||
listen srv1
|
listen srv1
|
||||||
bind "fd@${fes1}"
|
bind "fd@${fes1}"
|
||||||
@ -34,22 +48,24 @@ haproxy h1 -conf {
|
|||||||
http-request return status 200 hdr srv-id s2
|
http-request return status 200 hdr srv-id s2
|
||||||
} -start
|
} -start
|
||||||
|
|
||||||
client c1 -connect ${h1_feS_sock} {
|
### now the test in http-reuse never mode
|
||||||
txreq \
|
# 1,1,1
|
||||||
|
client c1 -connect ${h1_feN_sock} {
|
||||||
|
txreq -url /c1-1 \
|
||||||
-hdr "dst: ${h1_fes1_addr}" \
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes1_port}"
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
rxresp
|
rxresp
|
||||||
expect resp.http.http_reuse == "0"
|
expect resp.http.http_reuse == "0"
|
||||||
expect resp.http.srv-id == "s1"
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
txreq \
|
txreq -url /c1-2 \
|
||||||
-hdr "dst: ${h1_fes1_addr}" \
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes1_port}"
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
rxresp
|
rxresp
|
||||||
expect resp.http.http_reuse == "1"
|
expect resp.http.http_reuse == "1"
|
||||||
expect resp.http.srv-id == "s1"
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
txreq \
|
txreq -url /c1-3 \
|
||||||
-hdr "dst: ${h1_fes1_addr}" \
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes1_port}"
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
rxresp
|
rxresp
|
||||||
@ -57,22 +73,23 @@ client c1 -connect ${h1_feS_sock} {
|
|||||||
expect resp.http.srv-id == "s1"
|
expect resp.http.srv-id == "s1"
|
||||||
} -run
|
} -run
|
||||||
|
|
||||||
client c2 -connect ${h1_feS_sock} {
|
# 2,1,2
|
||||||
txreq \
|
client c2 -connect ${h1_feN_sock} {
|
||||||
|
txreq -url /c2-1 \
|
||||||
-hdr "dst: ${h1_fes2_addr}" \
|
-hdr "dst: ${h1_fes2_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes2_port}"
|
-hdr "dst-port: ${h1_fes2_port}"
|
||||||
rxresp
|
rxresp
|
||||||
expect resp.http.http_reuse == "0"
|
expect resp.http.http_reuse == "0"
|
||||||
expect resp.http.srv-id == "s2"
|
expect resp.http.srv-id == "s2"
|
||||||
|
|
||||||
txreq \
|
txreq -url /c2-2 \
|
||||||
-hdr "dst: ${h1_fes1_addr}" \
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes1_port}"
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
rxresp
|
rxresp
|
||||||
expect resp.http.http_reuse == "0"
|
expect resp.http.http_reuse == "0"
|
||||||
expect resp.http.srv-id == "s1"
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
txreq \
|
txreq -url /c2-3 \
|
||||||
-hdr "dst: ${h1_fes2_addr}" \
|
-hdr "dst: ${h1_fes2_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes2_port}"
|
-hdr "dst-port: ${h1_fes2_port}"
|
||||||
rxresp
|
rxresp
|
||||||
@ -80,22 +97,97 @@ client c2 -connect ${h1_feS_sock} {
|
|||||||
expect resp.http.srv-id == "s2"
|
expect resp.http.srv-id == "s2"
|
||||||
} -run
|
} -run
|
||||||
|
|
||||||
client c3 -connect ${h1_feS_sock} {
|
# 1,1,2
|
||||||
txreq \
|
client c3 -connect ${h1_feN_sock} {
|
||||||
|
txreq -url /c3-1 \
|
||||||
-hdr "dst: ${h1_fes1_addr}" \
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes1_port}"
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
rxresp
|
rxresp
|
||||||
expect resp.http.http_reuse == "0"
|
expect resp.http.http_reuse == "0"
|
||||||
expect resp.http.srv-id == "s1"
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
txreq \
|
txreq -url /c3-2 \
|
||||||
-hdr "dst: ${h1_fes1_addr}" \
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes1_port}"
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
rxresp
|
rxresp
|
||||||
expect resp.http.http_reuse == "1"
|
expect resp.http.http_reuse == "1"
|
||||||
expect resp.http.srv-id == "s1"
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
txreq \
|
txreq -url /c3-3 \
|
||||||
|
-hdr "dst: ${h1_fes2_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes2_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "0"
|
||||||
|
expect resp.http.srv-id == "s2"
|
||||||
|
} -run
|
||||||
|
|
||||||
|
### now the test in http-reuse safe mode
|
||||||
|
|
||||||
|
# 1,1,1
|
||||||
|
client c4 -connect ${h1_feA_sock} {
|
||||||
|
txreq -url /c4-1 \
|
||||||
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "0"
|
||||||
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
|
txreq -url /c4-2 \
|
||||||
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "1"
|
||||||
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
|
txreq -url /c4-3 \
|
||||||
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "1"
|
||||||
|
expect resp.http.srv-id == "s1"
|
||||||
|
} -run
|
||||||
|
|
||||||
|
# 2,1,2
|
||||||
|
client c5 -connect ${h1_feA_sock} {
|
||||||
|
txreq -url /c5-1 \
|
||||||
|
-hdr "dst: ${h1_fes2_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes2_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "0"
|
||||||
|
expect resp.http.srv-id == "s2"
|
||||||
|
|
||||||
|
txreq -url /c5-2 \
|
||||||
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "1"
|
||||||
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
|
txreq -url /c5-3 \
|
||||||
|
-hdr "dst: ${h1_fes2_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes2_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "0"
|
||||||
|
expect resp.http.srv-id == "s2"
|
||||||
|
} -run
|
||||||
|
|
||||||
|
# 1,1,2
|
||||||
|
client c6 -connect ${h1_feA_sock} {
|
||||||
|
txreq -url /c6-1 \
|
||||||
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "1"
|
||||||
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
|
txreq -url /c6-2 \
|
||||||
|
-hdr "dst: ${h1_fes1_addr}" \
|
||||||
|
-hdr "dst-port: ${h1_fes1_port}"
|
||||||
|
rxresp
|
||||||
|
expect resp.http.http_reuse == "1"
|
||||||
|
expect resp.http.srv-id == "s1"
|
||||||
|
|
||||||
|
txreq -url /c6-3 \
|
||||||
-hdr "dst: ${h1_fes2_addr}" \
|
-hdr "dst: ${h1_fes2_addr}" \
|
||||||
-hdr "dst-port: ${h1_fes2_port}"
|
-hdr "dst-port: ${h1_fes2_port}"
|
||||||
rxresp
|
rxresp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user