blob: 8c05f4306bbfc921efce1afa1163bf4cd483bc45 [file] [log] [blame]
Christopher Faulete41b4972021-10-13 18:06:55 +02001varnishtest "Test declaration of TCP rules in default sections"
2
Tim Duesterhus41922af2021-11-04 21:12:14 +01003feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
Christopher Faulete41b4972021-10-13 18:06:55 +02004feature ignore_unknown_macro
5
6server s1 {
7 rxreq
8 txresp
9 expect req.http.x-test1-frt == "def_front"
10 expect req.http.x-test1-bck == "def_back"
11} -start
12
13haproxy h1 -conf {
14 defaults common
15 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010016 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
17 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
18 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Christopher Faulete41b4972021-10-13 18:06:55 +020019
20 defaults def_front from common
21 tcp-request connection accept
22 tcp-request session accept
23 tcp-request inspect-delay 5s
24 tcp-request content set-var(txn.test1) "str(def_front)"
25 tcp-request content accept
26
27 defaults def_back from common
28 tcp-request inspect-delay 5s
29 tcp-request content set-var(txn.test1) "str(def_back)"
30 tcp-request content accept
31
32 tcp-response inspect-delay 5s
33 tcp-response content set-var(txn.test2) "str(def_back)"
34 tcp-response content accept
35
36 frontend fe from def_front
37 bind "fd@${feh1}"
38 tcp-request connection reject
39 tcp-request session reject
40 tcp-request content reject
41
42 http-request set-header x-test1-frt "%[var(txn.test1)]"
43
44 default_backend be
45
46 backend be from def_back
47 tcp-response content reject
48
49 http-request set-header x-test1-bck "%[var(txn.test1)]"
50 http-response set-header x-test2 "%[var(txn.test2)]"
51
52 server s1 ${s1_addr}:${s1_port}
53
54} -start
55
56client c1 -connect ${h1_feh1_sock} {
57 txreq -req GET -url /
58 rxresp
59 expect resp.status == 200
60 expect resp.http.x-test2 == "def_back"
61} -run