blob: 1c0facdf089d2126b2a7309f178d1f3ecceb0843 [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 Fauletc3d700c2022-06-07 08:20:12 +02007#REQUIRE_VERSION=2.0
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
12# b2 : Don't finish c2 before c1 and c3 before c4 (from syslog POV)
13# b3 : finish c3 before s2
14
Christopher Fauletb325b632022-05-17 15:08:22 +020015barrier b0 cond 2 -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
36syslog S -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
54haproxy h1 -conf {
Willy Tarreaue1465c12021-05-09 14:41:41 +020055 global
56 # WT: limit false-positives causing "HTTP header incomplete" due to
57 # idle server connections being randomly used and randomly expiring
58 # under us.
59 tune.idle-pool.shared off
60
Christopher Faulet16b37512021-04-07 14:37:07 +020061 defaults
62 mode http
63 ${no-htx} option http-use-htx
64 option abortonclose
65 retries 3
66 timeout client 10s
67 timeout server 10s
68 timeout connect 100ms
69 timeout queue 5s
70
71 frontend fe1
72 option httplog
73 log ${S_addr}:${S_port} local0 debug err
74 bind "fd@${fe1}"
Christopher Fauletb325b632022-05-17 15:08:22 +020075 use_backend be1_1 if { path /c1 }
76 use_backend be1_2 if { path /c2 }
Christopher Faulet16b37512021-04-07 14:37:07 +020077
78 frontend fe2
79 option httplog
80 log ${S_addr}:${S_port} local0 debug err
81 bind "fd@${fe2}"
82 use_backend be2
83
Christopher Fauletb325b632022-05-17 15:08:22 +020084 backend be1_1
85 server srv1 ${s1_addr}:${s1_port}
86
87 backend be1_2
88 timeout connect 1s
89 retries 10
Christopher Faulet16b37512021-04-07 14:37:07 +020090 server srv1 ${s1_addr}:${s1_port}
91
92 backend be2
93 server srv1 ${s2_addr}:${s2_port} maxconn 1
Christopher Fauletb325b632022-05-17 15:08:22 +020094
95 backend check
96 server srv1 ${s1_addr}:${s1_port} check
97 log ${S_addr}:${S_port} local0 debug alert
Christopher Faulet16b37512021-04-07 14:37:07 +020098} -start
99
Christopher Fauletb325b632022-05-17 15:08:22 +0200100# Wait s1 was detected as DOWN
101barrier b0 sync
102
Christopher Faulet16b37512021-04-07 14:37:07 +0200103# No server, wait all connection retries : SC--
104client c1 -connect ${h1_fe1_sock} {
105 txreq -url /c1
Willy Tarreau2b0ba5f2021-08-20 11:12:47 +0200106 rxresp
107 expect resp.status == 503
Christopher Faulet16b37512021-04-07 14:37:07 +0200108} -run
109
110# Wait c1 log entry
111barrier b2 sync
112
113# No server, abort during connections retries : CC--
114client c2 -connect ${h1_fe1_sock} {
115 txreq -url /c2
116} -run
117
Christopher Fauletc1333742022-06-02 13:56:00 +0200118# Wait c2 log entry
119barrier b2 sync
120
Christopher Faulet16b37512021-04-07 14:37:07 +0200121# server with maxconn=1, abort waiting the server reply : CH--
122client c3 -connect ${h1_fe2_sock} {
123 txreq -url /c3
124
125 # Wait c4 log entry
126 barrier b2 sync
127} -start
128
129# server with maxconn=1, abort waiting in the queue (c3 still attached) : CQ--
130client c4 -connect ${h1_fe2_sock} {
131 # Wait s2 receives c3 request
132 barrier b1 sync
133
134 txreq -url /c4
135 delay .2
136} -run
137
138client c3 -wait
139
140# unlock s2
141barrier b3 sync
142
143syslog S -wait