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 | |
Tim Duesterhus | 5efc48d | 2021-06-11 19:56:15 +0200 | [diff] [blame] | 7 | feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'" |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 8 | #REGTEST_TYPE=slow |
| 9 | |
Christopher Faulet | 96816b0 | 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 | 96816b0 | 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 | 96816b0 | 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 | 96816b0 | 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 | 96816b0 | 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]* -1 .* - - CC-- .* .* \"GET /c2 HTTP/1\\.1\"" |
Christopher Faulet | 0f98a15 | 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 |
Christopher Faulet | 3b9cb60 | 2021-06-02 17:23:47 +0200 | [diff] [blame] | 48 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/<NOSRV> [0-9]*/[0-9]*/-1/-1/[0-9]* -1 .* - - CQ-- .* .* \"GET /c4 HTTP/1\\.1\"" |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 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 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 63 | option abortonclose |
Willy Tarreau | 419c117 | 2021-11-18 17:15:59 +0100 | [diff] [blame] | 64 | retries 1 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 65 | timeout client 10s |
| 66 | timeout server 10s |
| 67 | timeout connect 100ms |
| 68 | timeout queue 5s |
| 69 | |
| 70 | frontend fe1 |
| 71 | option httplog |
| 72 | log ${S_addr}:${S_port} local0 debug err |
| 73 | bind "fd@${fe1}" |
Christopher Faulet | 96816b0 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 74 | use_backend be1_1 if { path /c1 } |
| 75 | use_backend be1_2 if { path /c2 } |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 76 | |
| 77 | frontend fe2 |
| 78 | option httplog |
| 79 | log ${S_addr}:${S_port} local0 debug err |
| 80 | bind "fd@${fe2}" |
| 81 | use_backend be2 |
| 82 | |
Christopher Faulet | 96816b0 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 83 | backend be1_1 |
| 84 | server srv1 ${s1_addr}:${s1_port} |
| 85 | |
| 86 | backend be1_2 |
| 87 | timeout connect 1s |
| 88 | retries 10 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 89 | server srv1 ${s1_addr}:${s1_port} |
| 90 | |
| 91 | backend be2 |
| 92 | server srv1 ${s2_addr}:${s2_port} maxconn 1 |
Christopher Faulet | 96816b0 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 93 | |
| 94 | backend check |
| 95 | server srv1 ${s1_addr}:${s1_port} check |
| 96 | log ${S_addr}:${S_port} local0 debug alert |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 97 | } -start |
| 98 | |
Christopher Faulet | 96816b0 | 2022-05-17 15:08:22 +0200 | [diff] [blame] | 99 | # Wait s1 was detected as DOWN |
| 100 | barrier b0 sync |
| 101 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 102 | # No server, wait all connection retries : SC-- |
| 103 | client c1 -connect ${h1_fe1_sock} { |
| 104 | txreq -url /c1 |
Willy Tarreau | 1713eec | 2021-08-20 11:12:47 +0200 | [diff] [blame] | 105 | rxresp |
| 106 | expect resp.status == 503 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 107 | } -run |
| 108 | |
| 109 | # Wait c1 log entry |
| 110 | barrier b2 sync |
| 111 | |
| 112 | # No server, abort during connections retries : CC-- |
| 113 | client c2 -connect ${h1_fe1_sock} { |
| 114 | txreq -url /c2 |
| 115 | } -run |
| 116 | |
Christopher Faulet | 0f98a15 | 2022-06-02 13:56:00 +0200 | [diff] [blame^] | 117 | # Wait c2 log entry |
| 118 | barrier b2 sync |
| 119 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 120 | # server with maxconn=1, abort waiting the server reply : CH-- |
| 121 | client c3 -connect ${h1_fe2_sock} { |
| 122 | txreq -url /c3 |
| 123 | |
| 124 | # Wait c4 log entry |
| 125 | barrier b2 sync |
| 126 | } -start |
| 127 | |
| 128 | # server with maxconn=1, abort waiting in the queue (c3 still attached) : CQ-- |
| 129 | client c4 -connect ${h1_fe2_sock} { |
| 130 | # Wait s2 receives c3 request |
| 131 | barrier b1 sync |
| 132 | |
| 133 | txreq -url /c4 |
| 134 | delay .2 |
| 135 | } -run |
| 136 | |
| 137 | client c3 -wait |
| 138 | |
| 139 | # unlock s2 |
| 140 | barrier b3 sync |
| 141 | |
| 142 | syslog S -wait |