blob: 0f56e87e9396ec50033f863d14a4c61f038238f6 [file] [log] [blame]
Christopher Faulet16b37512021-04-07 14:37:07 +02001varnishtest "A test for the abortonclose option (H1 only)"
2feature ignore_unknown_macro
3
4# NOTE : This test may fail if too many vtest are running in parallel because
5# the port reserved for closed s1 server may be reused by another vtest
6
Christopher Faulet5b3449e2023-11-14 09:03:15 +01007#REQUIRE_VERSION=2.2
Christopher Faulet16b37512021-04-07 14:37:07 +02008#REGTEST_TYPE=slow
9
Christopher Fauletb325b632022-05-17 15:08:22 +020010# b0 : Wait s1 was detected as DOWN to be sure it is stopped
Christopher Faulet16b37512021-04-07 14:37:07 +020011# b1 : Don't send /c4 before /c3 was received by s2 server
Christopher Faulet5b3449e2023-11-14 09:03:15 +010012# b2 : Used to receive syslog messages in the right order
Christopher Faulet16b37512021-04-07 14:37:07 +020013# b3 : finish c3 before s2
14
Christopher Faulet5b3449e2023-11-14 09:03:15 +010015barrier b0 cond 3 -cyclic
Christopher Faulet16b37512021-04-07 14:37:07 +020016barrier b1 cond 2 -cyclic
17barrier b2 cond 2 -cyclic
18barrier b3 cond 2 -cyclic
19
20server s1 {
21} -start
22server s1 -break
23
24server s2 {
25 rxreq
26
27 # unlock c4
28 barrier b1 sync
29
30 # wait end of c3
31 barrier b3 sync
32
33 expect_close
34} -start
35
Christopher Faulet5b3449e2023-11-14 09:03:15 +010036syslog S1 -level info {
Christopher Fauletb325b632022-05-17 15:08:22 +020037 recv alert
38 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: Server check/srv1 is DOWN.*"
39 barrier b0 sync
40
Christopher Faulet16b37512021-04-07 14:37:07 +020041 recv
Christopher Fauletb325b632022-05-17 15:08:22 +020042 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1_1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - SC-- .* .* \"GET /c1 HTTP/1\\.1\""
Christopher Faulet16b37512021-04-07 14:37:07 +020043 barrier b2 sync
44 recv
Christopher Fauletb325b632022-05-17 15:08:22 +020045 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1_2/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - CC-- .* .* \"GET /c2 HTTP/1\\.1\""
Christopher Fauletc1333742022-06-02 13:56:00 +020046 barrier b2 sync
Christopher Faulet16b37512021-04-07 14:37:07 +020047 recv
48 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/<NOSRV> [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - CQ-- .* .* \"GET /c4 HTTP/1\\.1\""
49 barrier b2 sync
50 recv
51 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/srv1 [0-9]*/[0-9]*/[0-9]*/-1/[0-9]* 400 .* - - CH-- .* .* \"GET /c3 HTTP/1\\.1\""
52} -start
53
Christopher Faulet5b3449e2023-11-14 09:03:15 +010054syslog S2 -level info {
55 recv alert
56 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: Server check/srv1 is DOWN.*"
57 barrier b0 sync
58
59 recv
60 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - CC-- .* .* \"GET /c5 HTTP/1\\.1\""
61 barrier b2 sync
62 recv
63 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - SC-- .* .* \"GET /c6 HTTP/1\\.1\""
64} -start
65
Christopher Faulet16b37512021-04-07 14:37:07 +020066haproxy h1 -conf {
Willy Tarreaue1465c12021-05-09 14:41:41 +020067 global
68 # WT: limit false-positives causing "HTTP header incomplete" due to
69 # idle server connections being randomly used and randomly expiring
70 # under us.
71 tune.idle-pool.shared off
72
Christopher Faulet16b37512021-04-07 14:37:07 +020073 defaults
74 mode http
75 ${no-htx} option http-use-htx
76 option abortonclose
77 retries 3
78 timeout client 10s
79 timeout server 10s
80 timeout connect 100ms
81 timeout queue 5s
82
83 frontend fe1
84 option httplog
Christopher Faulet5b3449e2023-11-14 09:03:15 +010085 log ${S1_addr}:${S1_port} local0 debug err
Christopher Faulet16b37512021-04-07 14:37:07 +020086 bind "fd@${fe1}"
Christopher Fauletb325b632022-05-17 15:08:22 +020087 use_backend be1_1 if { path /c1 }
88 use_backend be1_2 if { path /c2 }
Christopher Faulet16b37512021-04-07 14:37:07 +020089
90 frontend fe2
91 option httplog
Christopher Faulet5b3449e2023-11-14 09:03:15 +010092 log ${S1_addr}:${S1_port} local0 debug err
Christopher Faulet16b37512021-04-07 14:37:07 +020093 bind "fd@${fe2}"
94 use_backend be2
95
Christopher Fauletb325b632022-05-17 15:08:22 +020096 backend be1_1
97 server srv1 ${s1_addr}:${s1_port}
98
99 backend be1_2
100 timeout connect 1s
101 retries 10
Christopher Faulet16b37512021-04-07 14:37:07 +0200102 server srv1 ${s1_addr}:${s1_port}
103
104 backend be2
105 server srv1 ${s2_addr}:${s2_port} maxconn 1
Christopher Fauletb325b632022-05-17 15:08:22 +0200106
107 backend check
108 server srv1 ${s1_addr}:${s1_port} check
Christopher Faulet5b3449e2023-11-14 09:03:15 +0100109 log ${S1_addr}:${S1_port} local0 debug alert
110} -start
111
112
113haproxy h2 -conf {
114 global
115 # WT: limit false-positives causing "HTTP header incomplete" due to
116 # idle server connections being randomly used and randomly expiring
117 # under us.
118 tune.idle-pool.shared off
119
120 defaults
121 mode http
122 retries 1
123 timeout client 10s
124 timeout server 10s
125 timeout connect 100ms
126 timeout queue 5s
127
128 frontend fe1
129 option httplog
130 log ${S2_addr}:${S2_port} local0 debug err
131 bind "fd@${fe1}"
132 use_backend be1
133
134 backend be1
135 option abortonclose
136 server srv1 ${s1_addr}:${s1_port}
137
138 defaults
139 mode http
140 option abortonclose
141 retries 1
142 timeout client 10s
143 timeout server 10s
144 timeout connect 100ms
145 timeout queue 5s
146
147 frontend fe2
148 option httplog
149 log ${S2_addr}:${S2_port} local0 debug err
150 bind "fd@${fe2}"
151 use_backend be2
152
153 backend be2
154 no option abortonclose
155 server srv1 ${s1_addr}:${s1_port}
156
157 backend check
158 server srv1 ${s1_addr}:${s1_port} check
159 log ${S2_addr}:${S2_port} local0 debug alert
Christopher Faulet16b37512021-04-07 14:37:07 +0200160} -start
161
Christopher Faulet5b3449e2023-11-14 09:03:15 +0100162
Christopher Fauletb325b632022-05-17 15:08:22 +0200163# Wait s1 was detected as DOWN
164barrier b0 sync
165
Christopher Faulet16b37512021-04-07 14:37:07 +0200166# No server, wait all connection retries : SC--
167client c1 -connect ${h1_fe1_sock} {
168 txreq -url /c1
Willy Tarreau2b0ba5f2021-08-20 11:12:47 +0200169 rxresp
170 expect resp.status == 503
Christopher Faulet16b37512021-04-07 14:37:07 +0200171} -run
172
173# Wait c1 log entry
174barrier b2 sync
175
176# No server, abort during connections retries : CC--
177client c2 -connect ${h1_fe1_sock} {
178 txreq -url /c2
179} -run
180
Christopher Fauletc1333742022-06-02 13:56:00 +0200181# Wait c2 log entry
182barrier b2 sync
183
Christopher Faulet16b37512021-04-07 14:37:07 +0200184# server with maxconn=1, abort waiting the server reply : CH--
185client c3 -connect ${h1_fe2_sock} {
186 txreq -url /c3
187
188 # Wait c4 log entry
189 barrier b2 sync
190} -start
191
192# server with maxconn=1, abort waiting in the queue (c3 still attached) : CQ--
193client c4 -connect ${h1_fe2_sock} {
194 # Wait s2 receives c3 request
195 barrier b1 sync
196
197 txreq -url /c4
198 delay .2
199} -run
200
201client c3 -wait
202
203# unlock s2
204barrier b3 sync
205
Christopher Faulet5b3449e2023-11-14 09:03:15 +0100206syslog S1 -wait
207
208
209# No server, abort during connections retries : CC--
210# abortonclose on backend only
211client c5 -connect ${h2_fe1_sock} {
212 txreq -url /c5
213} -run
214
215# Wait c5 log entry
216barrier b2 sync
217
218# No server, wait all connection retries : SC--
219# abortonclose in defaults section but disabled by backend
220client c6 -connect ${h2_fe2_sock} {
221 txreq -url /c6
222 rxresp
223 expect resp.status == 503
224} -run
225
226
227syslog S2 -wait