mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-04 00:38:02 +00:00
REGTESTS: extend conn reuse test with transparent proxy
Recently, work on connection reuses reveals an issue when mixed with transparent proxy and set-dst. This patch rewrites the related regtests to be able to catch this now fixed bug. Note that it is the first regtest which relies on bc_reused recently introduced sample fetches. This fetch could be reuse in other related connection reuse regtests to simplify them.
This commit is contained in:
parent
ec76d52cea
commit
2f36162ee1
@ -18,68 +18,89 @@ haproxy h1 -conf {
|
||||
|
||||
listen sender
|
||||
bind "fd@${feS}"
|
||||
http-request set-header client-id %[req.hdr(client-id)] if { req.hdr(client-id) -m found }
|
||||
option transparent
|
||||
http-request set-dst-port int(${h1_feR_port})
|
||||
|
||||
listen receiver
|
||||
bind "fd@${feR}"
|
||||
http-request set-var(sess.client_id) req.hdr(client-id)
|
||||
http-request return status 200
|
||||
http-after-response set-header http_first_request %[http_first_req]
|
||||
http-after-response set-header client-id %[var(sess.client_id)]
|
||||
http-request set-dst hdr(dst)
|
||||
http-request set-dst-port hdr(dst-port)
|
||||
|
||||
http-after-response set-header http_reuse %[bc_reused]
|
||||
|
||||
listen srv1
|
||||
bind "fd@${fes1}"
|
||||
http-request add-header srv-id s1
|
||||
http-request return status 200 hdr srv-id s1
|
||||
|
||||
listen srv2
|
||||
bind "fd@${fes2}"
|
||||
http-request add-header srv-id s2
|
||||
http-request return status 200 hdr srv-id s2
|
||||
} -start
|
||||
|
||||
client c1 -connect ${h1_feS_sock} {
|
||||
txreq \
|
||||
-hdr "client-id: c1"
|
||||
-hdr "dst: ${h1_fes1_addr}" \
|
||||
-hdr "dst-port: ${h1_fes1_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "1"
|
||||
expect resp.http.http_reuse == "0"
|
||||
expect resp.http.srv-id == "s1"
|
||||
|
||||
txreq
|
||||
txreq \
|
||||
-hdr "dst: ${h1_fes1_addr}" \
|
||||
-hdr "dst-port: ${h1_fes1_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "0"
|
||||
expect resp.http.client-id == "c1"
|
||||
expect resp.http.http_reuse == "1"
|
||||
expect resp.http.srv-id == "s1"
|
||||
|
||||
txreq
|
||||
txreq \
|
||||
-hdr "dst: ${h1_fes1_addr}" \
|
||||
-hdr "dst-port: ${h1_fes1_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "0"
|
||||
expect resp.http.client-id == "c1"
|
||||
expect resp.http.http_reuse == "1"
|
||||
expect resp.http.srv-id == "s1"
|
||||
} -run
|
||||
|
||||
client c2 -connect ${h1_feS_sock} {
|
||||
txreq \
|
||||
-hdr "client-id: c2"
|
||||
-hdr "dst: ${h1_fes2_addr}" \
|
||||
-hdr "dst-port: ${h1_fes2_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "1"
|
||||
expect resp.http.client-id == "c2"
|
||||
expect resp.http.http_reuse == "0"
|
||||
expect resp.http.srv-id == "s2"
|
||||
|
||||
txreq
|
||||
txreq \
|
||||
-hdr "dst: ${h1_fes1_addr}" \
|
||||
-hdr "dst-port: ${h1_fes1_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "0"
|
||||
expect resp.http.client-id == "c2"
|
||||
expect resp.http.http_reuse == "0"
|
||||
expect resp.http.srv-id == "s1"
|
||||
|
||||
txreq
|
||||
txreq \
|
||||
-hdr "dst: ${h1_fes2_addr}" \
|
||||
-hdr "dst-port: ${h1_fes2_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "0"
|
||||
expect resp.http.client-id == "c2"
|
||||
expect resp.http.http_reuse == "1"
|
||||
expect resp.http.srv-id == "s2"
|
||||
} -run
|
||||
|
||||
client c3 -connect ${h1_feS_sock} {
|
||||
txreq \
|
||||
-hdr "client-id: c3"
|
||||
-hdr "dst: ${h1_fes1_addr}" \
|
||||
-hdr "dst-port: ${h1_fes1_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "1"
|
||||
expect resp.http.client-id == "c3"
|
||||
expect resp.http.http_reuse == "0"
|
||||
expect resp.http.srv-id == "s1"
|
||||
|
||||
txreq
|
||||
txreq \
|
||||
-hdr "dst: ${h1_fes1_addr}" \
|
||||
-hdr "dst-port: ${h1_fes1_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "0"
|
||||
expect resp.http.client-id == "c3"
|
||||
expect resp.http.http_reuse == "1"
|
||||
expect resp.http.srv-id == "s1"
|
||||
|
||||
txreq
|
||||
txreq \
|
||||
-hdr "dst: ${h1_fes2_addr}" \
|
||||
-hdr "dst-port: ${h1_fes2_port}"
|
||||
rxresp
|
||||
expect resp.http.http_first_request == "0"
|
||||
expect resp.http.client-id == "c3"
|
||||
expect resp.http.http_reuse == "0"
|
||||
expect resp.http.srv-id == "s2"
|
||||
} -run
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user