blob: c0749825717c72990e6756d776ae0c0ad5843f5a [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
7#REQUIRE_VERSION=2.3
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
14barrier b1 cond 2 -cyclic
15barrier b2 cond 2 -cyclic
16barrier b3 cond 2 -cyclic
17
18server s1 {
19} -start
20server s1 -break
21
22server 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
34syslog 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
39 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - CC-- .* .* \"GET /c2 HTTP/1\\.1\""
40
41 recv
42 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/<NOSRV> [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - CQ-- .* .* \"GET /c4 HTTP/1\\.1\""
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
48haproxy h1 -conf {
49 defaults
50 mode http
51 ${no-htx} option http-use-htx
52 option abortonclose
53 retries 3
54 timeout client 10s
55 timeout server 10s
56 timeout connect 100ms
57 timeout queue 5s
58
59 frontend fe1
60 option httplog
61 log ${S_addr}:${S_port} local0 debug err
62 bind "fd@${fe1}"
63 use_backend be1
64
65 frontend fe2
66 option httplog
67 log ${S_addr}:${S_port} local0 debug err
68 bind "fd@${fe2}"
69 use_backend be2
70
71 backend be1
72 server srv1 ${s1_addr}:${s1_port}
73
74 backend be2
75 server srv1 ${s2_addr}:${s2_port} maxconn 1
76} -start
77
78# No server, wait all connection retries : SC--
79client c1 -connect ${h1_fe1_sock} {
80 txreq -url /c1
81 expect_close
82} -run
83
84# Wait c1 log entry
85barrier b2 sync
86
87# No server, abort during connections retries : CC--
88client c2 -connect ${h1_fe1_sock} {
89 txreq -url /c2
90} -run
91
92# server with maxconn=1, abort waiting the server reply : CH--
93client c3 -connect ${h1_fe2_sock} {
94 txreq -url /c3
95
96 # Wait c4 log entry
97 barrier b2 sync
98} -start
99
100# server with maxconn=1, abort waiting in the queue (c3 still attached) : CQ--
101client c4 -connect ${h1_fe2_sock} {
102 # Wait s2 receives c3 request
103 barrier b1 sync
104
105 txreq -url /c4
106 delay .2
107} -run
108
109client c3 -wait
110
111# unlock s2
112barrier b3 sync
113
114syslog S -wait