mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-20 10:40:13 +00:00
f673923629
With the CI occasionally slowing down, we're starting to see again some spurious failures despite the long 1-second timeouts. This reports false positives that are disturbing and doesn't provide as much value as this could. However at this delay it already becomes a pain for developers to wait for the tests to complete. This commit adds support for the new environment variable HAPROXY_TEST_TIMEOUT that will allow anyone to modify the connect, client and server timeouts. It was set to 5 seconds by default, which should be plenty for quite some time in the CI. All relevant values that were 200ms or above were replaced by this one. A few larger values were left as they are special. One test for the set-timeout action that used to rely on a fixed 1-sec value was extended to a fixed 5-sec, as the timeout is normally not reached, but it needs to be known to compare the old and new values.
291 lines
11 KiB
Plaintext
291 lines
11 KiB
Plaintext
varnishtest "Test multi-level client source and destination addresses"
|
|
|
|
feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
|
|
feature ignore_unknown_macro
|
|
|
|
haproxy h1 -conf {
|
|
defaults
|
|
mode http
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
frontend fe1
|
|
bind "fd@${fe1}"
|
|
tcp-request connection set-src ipv4(10.0.0.1)
|
|
tcp-request connection set-dst ipv4(10.0.0.2)
|
|
|
|
tcp-request session set-var(sess.sess_fc_src) fc_src
|
|
tcp-request session set-var(sess.sess_fc_dst) fc_dst
|
|
tcp-request session set-var(sess.sess_src) src
|
|
tcp-request session set-var(sess.sess_dst) dst
|
|
|
|
tcp-request inspect-delay 100ms
|
|
tcp-request content set-var(txn.strm_fc_src) fc_src
|
|
tcp-request content set-var(txn.strm_fc_dst) fc_dst
|
|
tcp-request content set-var(txn.strm_src) src
|
|
tcp-request content set-var(txn.strm_dst) dst
|
|
|
|
http-after-response set-header sess-fc-src %[var(sess.sess_fc_src)]
|
|
http-after-response set-header sess-src %[var(sess.sess_src)]
|
|
http-after-response set-header sess-fc-dst %[var(sess.sess_fc_dst)]
|
|
http-after-response set-header sess-dst %[var(sess.sess_dst)]
|
|
http-after-response set-header strm-fc-src %[var(txn.strm_fc_src)]
|
|
http-after-response set-header strm-src %[var(txn.strm_src)]
|
|
http-after-response set-header strm-fc-dst %[var(txn.strm_fc_dst)]
|
|
http-after-response set-header strm-dst %[var(txn.strm_dst)]
|
|
|
|
default_backend be
|
|
|
|
frontend fe2
|
|
bind "fd@${fe2}"
|
|
tcp-request connection set-src ipv4(10.0.0.1)
|
|
tcp-request connection set-dst ipv4(10.0.0.2)
|
|
|
|
tcp-request session set-src ipv4(10.1.0.1)
|
|
tcp-request session set-dst ipv4(10.1.0.2)
|
|
tcp-request session set-var(sess.sess_fc_src) fc_src
|
|
tcp-request session set-var(sess.sess_fc_dst) fc_dst
|
|
tcp-request session set-var(sess.sess_src) src
|
|
tcp-request session set-var(sess.sess_dst) dst
|
|
|
|
tcp-request inspect-delay 100ms
|
|
tcp-request content set-var(txn.strm_fc_src) fc_src
|
|
tcp-request content set-var(txn.strm_fc_dst) fc_dst
|
|
tcp-request content set-var(txn.strm_src) src
|
|
tcp-request content set-var(txn.strm_dst) dst
|
|
|
|
http-after-response set-header sess-fc-src %[var(sess.sess_fc_src)]
|
|
http-after-response set-header sess-src %[var(sess.sess_src)]
|
|
http-after-response set-header sess-fc-dst %[var(sess.sess_fc_dst)]
|
|
http-after-response set-header sess-dst %[var(sess.sess_dst)]
|
|
http-after-response set-header strm-fc-src %[var(txn.strm_fc_src)]
|
|
http-after-response set-header strm-src %[var(txn.strm_src)]
|
|
http-after-response set-header strm-fc-dst %[var(txn.strm_fc_dst)]
|
|
http-after-response set-header strm-dst %[var(txn.strm_dst)]
|
|
|
|
default_backend be
|
|
|
|
frontend fe3
|
|
bind "fd@${fe3}"
|
|
tcp-request connection set-src ipv4(10.0.0.1)
|
|
tcp-request connection set-dst ipv4(10.0.0.2)
|
|
|
|
tcp-request session set-src ipv4(10.1.0.1)
|
|
tcp-request session set-dst ipv4(10.1.0.2)
|
|
tcp-request session set-var(sess.sess_fc_src) fc_src
|
|
tcp-request session set-var(sess.sess_fc_dst) fc_dst
|
|
tcp-request session set-var(sess.sess_src) src
|
|
tcp-request session set-var(sess.sess_dst) dst
|
|
|
|
tcp-request inspect-delay 100ms
|
|
tcp-request content set-src ipv4(10.2.0.1)
|
|
tcp-request content set-dst ipv4(10.2.0.2)
|
|
tcp-request content set-var(txn.strm_fc_src) fc_src
|
|
tcp-request content set-var(txn.strm_fc_dst) fc_dst
|
|
tcp-request content set-var(txn.strm_src) src
|
|
tcp-request content set-var(txn.strm_dst) dst
|
|
|
|
http-after-response set-header sess-fc-src %[var(sess.sess_fc_src)]
|
|
http-after-response set-header sess-src %[var(sess.sess_src)]
|
|
http-after-response set-header sess-fc-dst %[var(sess.sess_fc_dst)]
|
|
http-after-response set-header sess-dst %[var(sess.sess_dst)]
|
|
http-after-response set-header strm-fc-src %[var(txn.strm_fc_src)]
|
|
http-after-response set-header strm-src %[var(txn.strm_src)]
|
|
http-after-response set-header strm-fc-dst %[var(txn.strm_fc_dst)]
|
|
http-after-response set-header strm-dst %[var(txn.strm_dst)]
|
|
|
|
|
|
frontend fe4
|
|
bind "fd@${fe4}"
|
|
|
|
tcp-request connection set-src ipv4(10.0.0.1)
|
|
tcp-request connection set-dst ipv4(10.0.0.2)
|
|
|
|
tcp-request session set-var(sess.sess_fc_src) fc_src
|
|
tcp-request session set-var(sess.sess_fc_dst) fc_dst
|
|
tcp-request session set-var(sess.sess_src) src
|
|
tcp-request session set-var(sess.sess_dst) dst
|
|
|
|
http-request set-src hdr(x-forwarded-for)
|
|
http-request set-dst hdr(x-original-to)
|
|
http-request set-var(txn.strm_fc_src) fc_src
|
|
http-request set-var(txn.strm_fc_dst) fc_dst
|
|
http-request set-var(txn.strm_src) src
|
|
http-request set-var(txn.strm_dst) dst
|
|
|
|
http-after-response set-header sess-fc-src %[var(sess.sess_fc_src)]
|
|
http-after-response set-header sess-src %[var(sess.sess_src)]
|
|
http-after-response set-header sess-fc-dst %[var(sess.sess_fc_dst)]
|
|
http-after-response set-header sess-dst %[var(sess.sess_dst)]
|
|
http-after-response set-header strm-fc-src %[var(txn.strm_fc_src)]
|
|
http-after-response set-header strm-src %[var(txn.strm_src)]
|
|
http-after-response set-header strm-fc-dst %[var(txn.strm_fc_dst)]
|
|
http-after-response set-header strm-dst %[var(txn.strm_dst)]
|
|
|
|
default_backend be
|
|
|
|
backend be
|
|
http-request return status 200
|
|
|
|
listen li1
|
|
bind "fd@${li1}"
|
|
|
|
tcp-request connection set-src ipv4(10.0.0.1)
|
|
tcp-request connection set-dst ipv4(10.0.0.2)
|
|
|
|
http-request set-src ipv4(192.168.0.1)
|
|
http-request set-dst ipv4(192.168.0.2)
|
|
|
|
http-after-response set-header li1-fc-src %[fc_src]
|
|
http-after-response set-header li1-src %[src]
|
|
http-after-response set-header li1-fc-dst %[fc_dst]
|
|
http-after-response set-header li1-dst %[dst]
|
|
|
|
|
|
server srv ${h1_li3_addr}:${h1_li3_port} send-proxy
|
|
|
|
listen li2
|
|
bind "fd@${li2}"
|
|
|
|
tcp-request connection set-src ipv4(10.0.0.1)
|
|
tcp-request connection set-dst ipv4(10.0.0.2)
|
|
|
|
http-request set-src ipv4(192.168.0.1)
|
|
http-request set-dst ipv4(192.168.0.2)
|
|
|
|
http-after-response set-header li2-fc-src %[fc_src]
|
|
http-after-response set-header li2-src %[src]
|
|
http-after-response set-header li2-fc-dst %[fc_dst]
|
|
http-after-response set-header li2-dst %[dst]
|
|
|
|
server srv ${h1_li3_addr}:${h1_li3_port} send-proxy-v2
|
|
|
|
listen li3
|
|
bind "fd@${li3}" accept-proxy
|
|
|
|
tcp-request connection set-src ipv4(10.1.0.1)
|
|
tcp-request connection set-dst ipv4(10.1.0.2)
|
|
|
|
http-after-response set-header li3-fc-src %[fc_src]
|
|
http-after-response set-header li3-src %[src]
|
|
http-after-response set-header li3-fc-dst %[fc_dst]
|
|
http-after-response set-header li3-dst %[dst]
|
|
|
|
http-request return status 200
|
|
|
|
} -start
|
|
|
|
|
|
client c1 -connect ${h1_fe1_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.http.sess-fc-src == 10.0.0.1
|
|
expect resp.http.sess-src == 10.0.0.1
|
|
expect resp.http.strm-fc-src == 10.0.0.1
|
|
expect resp.http.strm-src == 10.0.0.1
|
|
|
|
expect resp.http.sess-fc-dst == 10.0.0.2
|
|
expect resp.http.sess-dst == 10.0.0.2
|
|
expect resp.http.strm-fc-dst == 10.0.0.2
|
|
expect resp.http.strm-dst == 10.0.0.2
|
|
} -run
|
|
|
|
client c2 -connect ${h1_fe2_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.http.sess-fc-src == 10.0.0.1
|
|
expect resp.http.sess-src == 10.1.0.1
|
|
expect resp.http.strm-fc-src == 10.0.0.1
|
|
expect resp.http.strm-src == 10.1.0.1
|
|
|
|
expect resp.http.sess-fc-dst == 10.0.0.2
|
|
expect resp.http.sess-dst == 10.1.0.2
|
|
expect resp.http.strm-fc-dst == 10.0.0.2
|
|
expect resp.http.strm-dst == 10.1.0.2
|
|
} -run
|
|
|
|
client c3 -connect ${h1_fe3_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.http.sess-fc-src == 10.0.0.1
|
|
expect resp.http.sess-src == 10.1.0.1
|
|
expect resp.http.strm-fc-src == 10.0.0.1
|
|
expect resp.http.strm-src == 10.2.0.1
|
|
|
|
expect resp.http.sess-fc-dst == 10.0.0.2
|
|
expect resp.http.sess-dst == 10.1.0.2
|
|
expect resp.http.strm-fc-dst == 10.0.0.2
|
|
expect resp.http.strm-dst == 10.2.0.2
|
|
} -run
|
|
|
|
client c4 -connect ${h1_fe4_sock} {
|
|
txreq \
|
|
-hdr "x-forwarded-for: 192.168.0.1" \
|
|
-hdr "x-original-to: 192.168.0.2"
|
|
rxresp
|
|
expect resp.http.sess-fc-src == 10.0.0.1
|
|
expect resp.http.sess-src == 10.0.0.1
|
|
expect resp.http.strm-fc-src == 10.0.0.1
|
|
expect resp.http.strm-src == 192.168.0.1
|
|
|
|
expect resp.http.sess-fc-dst == 10.0.0.2
|
|
expect resp.http.sess-dst == 10.0.0.2
|
|
expect resp.http.strm-fc-dst == 10.0.0.2
|
|
expect resp.http.strm-dst == 192.168.0.2
|
|
|
|
txreq \
|
|
-hdr "x-forwarded-for: 192.168.1.1" \
|
|
-hdr "x-original-to: 192.168.1.2"
|
|
rxresp
|
|
expect resp.http.sess-fc-src == 10.0.0.1
|
|
expect resp.http.sess-src == 10.0.0.1
|
|
expect resp.http.strm-fc-src == 10.0.0.1
|
|
expect resp.http.strm-src == 192.168.1.1
|
|
|
|
expect resp.http.sess-fc-dst == 10.0.0.2
|
|
expect resp.http.sess-dst == 10.0.0.2
|
|
expect resp.http.strm-fc-dst == 10.0.0.2
|
|
expect resp.http.strm-dst == 192.168.1.2
|
|
|
|
txreq
|
|
rxresp
|
|
expect resp.http.sess-fc-src == 10.0.0.1
|
|
expect resp.http.sess-src == 10.0.0.1
|
|
expect resp.http.strm-fc-src == 10.0.0.1
|
|
expect resp.http.strm-src == 10.0.0.1
|
|
|
|
expect resp.http.sess-fc-dst == 10.0.0.2
|
|
expect resp.http.sess-dst == 10.0.0.2
|
|
expect resp.http.strm-fc-dst == 10.0.0.2
|
|
expect resp.http.strm-dst == 10.0.0.2
|
|
} -run
|
|
|
|
client c5 -connect ${h1_li1_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.http.li1-fc-src == 10.0.0.1
|
|
expect resp.http.li1-src == 192.168.0.1
|
|
expect resp.http.li1-fc-dst == 10.0.0.2
|
|
expect resp.http.li1-dst == 192.168.0.2
|
|
|
|
expect resp.http.li3-fc-src == 10.1.0.1
|
|
expect resp.http.li3-src == 192.168.0.1
|
|
expect resp.http.li3-fc-dst == 10.1.0.2
|
|
expect resp.http.li3-dst == 192.168.0.2
|
|
} -run
|
|
|
|
client c6 -connect ${h1_li2_sock} {
|
|
txreq
|
|
rxresp
|
|
expect resp.http.li2-fc-src == 10.0.0.1
|
|
expect resp.http.li2-src == 192.168.0.1
|
|
expect resp.http.li2-fc-dst == 10.0.0.2
|
|
expect resp.http.li2-dst == 192.168.0.2
|
|
|
|
expect resp.http.li3-fc-src == 10.1.0.1
|
|
expect resp.http.li3-src == 192.168.0.1
|
|
expect resp.http.li3-fc-dst == 10.1.0.2
|
|
expect resp.http.li3-dst == 192.168.0.2
|
|
} -run
|