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 | c3d700c | 2022-06-07 08:20:12 +0200 | [diff] [blame^] | 7 | #REQUIRE_VERSION=2.0 |
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 |
| 12 | # b2 : Don't finish c2 before c1 and c3 before c4 (from syslog POV) |
| 13 | # b3 : finish c3 before s2 |
| 14 | |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 15 | barrier b0 cond 2 -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 | |
| 36 | syslog S -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 | |
| 54 | haproxy h1 -conf { |
Willy Tarreau | e1465c1 | 2021-05-09 14:41:41 +0200 | [diff] [blame] | 55 | 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 Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 61 | 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 Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 75 | use_backend be1_1 if { path /c1 } |
| 76 | use_backend be1_2 if { path /c2 } |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 77 | |
| 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 Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 84 | backend be1_1 |
| 85 | server srv1 ${s1_addr}:${s1_port} |
| 86 | |
| 87 | backend be1_2 |
| 88 | timeout connect 1s |
| 89 | retries 10 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 90 | server srv1 ${s1_addr}:${s1_port} |
| 91 | |
| 92 | backend be2 |
| 93 | server srv1 ${s2_addr}:${s2_port} maxconn 1 |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 94 | |
| 95 | backend check |
| 96 | server srv1 ${s1_addr}:${s1_port} check |
| 97 | log ${S_addr}:${S_port} local0 debug alert |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 98 | } -start |
| 99 | |
Christopher Faulet | b325b63 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 100 | # Wait s1 was detected as DOWN |
| 101 | barrier b0 sync |
| 102 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 103 | # No server, wait all connection retries : SC-- |
| 104 | client c1 -connect ${h1_fe1_sock} { |
| 105 | txreq -url /c1 |
Willy Tarreau | 2b0ba5f | 2021-08-20 11:12:47 +0200 | [diff] [blame] | 106 | rxresp |
| 107 | expect resp.status == 503 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 108 | } -run |
| 109 | |
| 110 | # Wait c1 log entry |
| 111 | barrier b2 sync |
| 112 | |
| 113 | # No server, abort during connections retries : CC-- |
| 114 | client c2 -connect ${h1_fe1_sock} { |
| 115 | txreq -url /c2 |
| 116 | } -run |
| 117 | |
Christopher Faulet | c133374 | 2022-06-02 13:56:00 +0200 | [diff] [blame] | 118 | # Wait c2 log entry |
| 119 | barrier b2 sync |
| 120 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 121 | # server with maxconn=1, abort waiting the server reply : CH-- |
| 122 | client 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-- |
| 130 | client 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 | |
| 138 | client c3 -wait |
| 139 | |
| 140 | # unlock s2 |
| 141 | barrier b3 sync |
| 142 | |
| 143 | syslog S -wait |