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 | |
| 10 | # b1 : Don't send /c4 before /c3 was received by s2 server |
| 11 | # b2 : Don't finish c2 before c1 and c3 before c4 (from syslog POV) |
| 12 | # b3 : finish c3 before s2 |
| 13 | |
| 14 | barrier b1 cond 2 -cyclic |
| 15 | barrier b2 cond 2 -cyclic |
| 16 | barrier b3 cond 2 -cyclic |
| 17 | |
| 18 | server s1 { |
| 19 | } -start |
| 20 | server s1 -break |
| 21 | |
| 22 | server s2 { |
| 23 | rxreq |
| 24 | |
| 25 | # unlock c4 |
| 26 | barrier b1 sync |
| 27 | |
| 28 | # wait end of c3 |
| 29 | barrier b3 sync |
| 30 | |
| 31 | expect_close |
| 32 | } -start |
| 33 | |
| 34 | syslog S -level info { |
| 35 | recv |
| 36 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - SC-- .* .* \"GET /c1 HTTP/1\\.1\"" |
| 37 | barrier b2 sync |
| 38 | recv |
Christopher Faulet | 3b9cb60 | 2021-06-02 17:23:47 +0200 | [diff] [blame] | 39 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* -1 .* - - CC-- .* .* \"GET /c2 HTTP/1\\.1\"" |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 40 | |
| 41 | recv |
Christopher Faulet | 3b9cb60 | 2021-06-02 17:23:47 +0200 | [diff] [blame] | 42 | 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] | 43 | barrier b2 sync |
| 44 | recv |
| 45 | expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/srv1 [0-9]*/[0-9]*/[0-9]*/-1/[0-9]* 400 .* - - CH-- .* .* \"GET /c3 HTTP/1\\.1\"" |
| 46 | } -start |
| 47 | |
| 48 | haproxy h1 -conf { |
Willy Tarreau | e1465c1 | 2021-05-09 14:41:41 +0200 | [diff] [blame] | 49 | global |
| 50 | # WT: limit false-positives causing "HTTP header incomplete" due to |
| 51 | # idle server connections being randomly used and randomly expiring |
| 52 | # under us. |
| 53 | tune.idle-pool.shared off |
| 54 | |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 55 | defaults |
| 56 | mode http |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 57 | option abortonclose |
Willy Tarreau | 419c117 | 2021-11-18 17:15:59 +0100 | [diff] [blame] | 58 | retries 1 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 59 | timeout client 10s |
| 60 | timeout server 10s |
| 61 | timeout connect 100ms |
| 62 | timeout queue 5s |
| 63 | |
| 64 | frontend fe1 |
| 65 | option httplog |
| 66 | log ${S_addr}:${S_port} local0 debug err |
| 67 | bind "fd@${fe1}" |
| 68 | use_backend be1 |
| 69 | |
| 70 | frontend fe2 |
| 71 | option httplog |
| 72 | log ${S_addr}:${S_port} local0 debug err |
| 73 | bind "fd@${fe2}" |
| 74 | use_backend be2 |
| 75 | |
| 76 | backend be1 |
| 77 | server srv1 ${s1_addr}:${s1_port} |
| 78 | |
| 79 | backend be2 |
| 80 | server srv1 ${s2_addr}:${s2_port} maxconn 1 |
| 81 | } -start |
| 82 | |
| 83 | # No server, wait all connection retries : SC-- |
| 84 | client c1 -connect ${h1_fe1_sock} { |
| 85 | txreq -url /c1 |
Willy Tarreau | 1713eec | 2021-08-20 11:12:47 +0200 | [diff] [blame] | 86 | rxresp |
| 87 | expect resp.status == 503 |
Christopher Faulet | 16b3751 | 2021-04-07 14:37:07 +0200 | [diff] [blame] | 88 | } -run |
| 89 | |
| 90 | # Wait c1 log entry |
| 91 | barrier b2 sync |
| 92 | |
| 93 | # No server, abort during connections retries : CC-- |
| 94 | client c2 -connect ${h1_fe1_sock} { |
| 95 | txreq -url /c2 |
| 96 | } -run |
| 97 | |
| 98 | # server with maxconn=1, abort waiting the server reply : CH-- |
| 99 | client c3 -connect ${h1_fe2_sock} { |
| 100 | txreq -url /c3 |
| 101 | |
| 102 | # Wait c4 log entry |
| 103 | barrier b2 sync |
| 104 | } -start |
| 105 | |
| 106 | # server with maxconn=1, abort waiting in the queue (c3 still attached) : CQ-- |
| 107 | client c4 -connect ${h1_fe2_sock} { |
| 108 | # Wait s2 receives c3 request |
| 109 | barrier b1 sync |
| 110 | |
| 111 | txreq -url /c4 |
| 112 | delay .2 |
| 113 | } -run |
| 114 | |
| 115 | client c3 -wait |
| 116 | |
| 117 | # unlock s2 |
| 118 | barrier b3 sync |
| 119 | |
| 120 | syslog S -wait |