Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 1 | varnishtest "A test for the abortonclose option (H1 only)" |
| 2 | feature 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 Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 7 | #REQUIRE_VERSION=2.2 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 8 | #REGTEST_TYPE=slow |
| 9 | |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 10 | # b0 : Wait s1 was detected as DOWN to be sure it is stopped |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 11 | # b1 : Don't send /c4 before /c3 was received by s2 server |
Christopher Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 12 | # b2 : Used to receive syslog messages in the right order |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 13 | # b3 : finish c3 before s2 |
| 14 | |
Christopher Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 15 | barrier b0 cond 3 -cyclic |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 16 | barrier b1 cond 2 -cyclic |
| 17 | barrier b2 cond 2 -cyclic |
| 18 | barrier b3 cond 2 -cyclic |
| 19 | |
| 20 | server s1 { |
| 21 | } -start |
| 22 | server s1 -break |
| 23 | |
| 24 | server 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 Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 36 | syslog S1 -level info { |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 37 | recv alert |
| 38 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: Server check/srv1 is DOWN.*" |
| 39 | barrier b0 sync |
| 40 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 41 | recv |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 42 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1_1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - SC-- .* .* \"GET /c1 HTTP/1\\.1\"" |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 43 | barrier b2 sync |
| 44 | recv |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 45 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1_2/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - CC-- .* .* \"GET /c2 HTTP/1\\.1\"" |
Christopher Faulet | c133374 | 2022-06-02 13:56:00 +0200 | [diff] [blame] | 46 | barrier b2 sync |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 47 | 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 Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 54 | syslog 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 Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 66 | haproxy h1 -conf { |
Willy Tarreau | e1465c1 | 2021-05-09 14:41:41 +0200 | [diff] [blame] | 67 | 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 Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 73 | 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 Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 85 | log ${S1_addr}:${S1_port} local0 debug err |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 86 | bind "fd@${fe1}" |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 87 | use_backend be1_1 if { path /c1 } |
| 88 | use_backend be1_2 if { path /c2 } |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 89 | |
| 90 | frontend fe2 |
| 91 | option httplog |
Christopher Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 92 | log ${S1_addr}:${S1_port} local0 debug err |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 93 | bind "fd@${fe2}" |
| 94 | use_backend be2 |
| 95 | |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 96 | backend be1_1 |
| 97 | server srv1 ${s1_addr}:${s1_port} |
| 98 | |
| 99 | backend be1_2 |
| 100 | timeout connect 1s |
| 101 | retries 10 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 102 | server srv1 ${s1_addr}:${s1_port} |
| 103 | |
| 104 | backend be2 |
| 105 | server srv1 ${s2_addr}:${s2_port} maxconn 1 |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 106 | |
| 107 | backend check |
| 108 | server srv1 ${s1_addr}:${s1_port} check |
Christopher Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 109 | log ${S1_addr}:${S1_port} local0 debug alert |
| 110 | } -start |
| 111 | |
| 112 | |
| 113 | haproxy 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 Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 160 | } -start |
| 161 | |
Christopher Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 162 | |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 163 | # Wait s1 was detected as DOWN |
| 164 | barrier b0 sync |
| 165 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 166 | # No server, wait all connection retries : SC-- |
| 167 | client c1 -connect ${h1_fe1_sock} { |
| 168 | txreq -url /c1 |
Willy Tarreau | 2b0ba5f | 2021-08-20 11:12:47 +0200 | [diff] [blame] | 169 | rxresp |
| 170 | expect resp.status == 503 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 171 | } -run |
| 172 | |
| 173 | # Wait c1 log entry |
| 174 | barrier b2 sync |
| 175 | |
| 176 | # No server, abort during connections retries : CC-- |
| 177 | client c2 -connect ${h1_fe1_sock} { |
| 178 | txreq -url /c2 |
| 179 | } -run |
| 180 | |
Christopher Faulet | c133374 | 2022-06-02 13:56:00 +0200 | [diff] [blame] | 181 | # Wait c2 log entry |
| 182 | barrier b2 sync |
| 183 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 184 | # server with maxconn=1, abort waiting the server reply : CH-- |
| 185 | client 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-- |
| 193 | client 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 | |
| 201 | client c3 -wait |
| 202 | |
| 203 | # unlock s2 |
| 204 | barrier b3 sync |
| 205 | |
Christopher Faulet | 5b3449e | 2023-11-14 09:03:15 +0100 | [diff] [blame] | 206 | syslog S1 -wait |
| 207 | |
| 208 | |
| 209 | # No server, abort during connections retries : CC-- |
| 210 | # abortonclose on backend only |
| 211 | client c5 -connect ${h2_fe1_sock} { |
| 212 | txreq -url /c5 |
| 213 | } -run |
| 214 | |
| 215 | # Wait c5 log entry |
| 216 | barrier b2 sync |
| 217 | |
| 218 | # No server, wait all connection retries : SC-- |
| 219 | # abortonclose in defaults section but disabled by backend |
| 220 | client c6 -connect ${h2_fe2_sock} { |
| 221 | txreq -url /c6 |
| 222 | rxresp |
| 223 | expect resp.status == 503 |
| 224 | } -run |
| 225 | |
| 226 | |
| 227 | syslog S2 -wait |