2021-04-07 12:37:07 +00:00
|
|
|
varnishtest "A test for the abortonclose option (H1 only)"
|
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
# NOTE : This test may fail if too many vtest are running in parallel because
|
|
|
|
# the port reserved for closed s1 server may be reused by another vtest
|
|
|
|
|
2021-06-11 17:56:15 +00:00
|
|
|
feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
|
2021-04-07 12:37:07 +00:00
|
|
|
#REGTEST_TYPE=slow
|
|
|
|
|
2022-05-17 13:08:22 +00:00
|
|
|
# b0 : Wait s1 was detected as DOWN to be sure it is stopped
|
2021-04-07 12:37:07 +00:00
|
|
|
# b1 : Don't send /c4 before /c3 was received by s2 server
|
|
|
|
# b2 : Don't finish c2 before c1 and c3 before c4 (from syslog POV)
|
|
|
|
# b3 : finish c3 before s2
|
|
|
|
|
2022-05-17 13:08:22 +00:00
|
|
|
barrier b0 cond 2 -cyclic
|
2021-04-07 12:37:07 +00:00
|
|
|
barrier b1 cond 2 -cyclic
|
|
|
|
barrier b2 cond 2 -cyclic
|
|
|
|
barrier b3 cond 2 -cyclic
|
|
|
|
|
|
|
|
server s1 {
|
|
|
|
} -start
|
|
|
|
server s1 -break
|
|
|
|
|
|
|
|
server s2 {
|
|
|
|
rxreq
|
|
|
|
|
|
|
|
# unlock c4
|
|
|
|
barrier b1 sync
|
|
|
|
|
|
|
|
# wait end of c3
|
|
|
|
barrier b3 sync
|
|
|
|
|
|
|
|
expect_close
|
|
|
|
} -start
|
|
|
|
|
|
|
|
syslog S -level info {
|
2022-05-17 13:08:22 +00:00
|
|
|
recv alert
|
|
|
|
expect ~ "[^:\\[ ]*\\[[0-9]*\\]: Server check/srv1 is DOWN.*"
|
|
|
|
barrier b0 sync
|
|
|
|
|
2021-04-07 12:37:07 +00:00
|
|
|
recv
|
2022-05-17 13:08:22 +00:00
|
|
|
expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1_1/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* 503 .* - - SC-- .* .* \"GET /c1 HTTP/1\\.1\""
|
2021-04-07 12:37:07 +00:00
|
|
|
barrier b2 sync
|
|
|
|
recv
|
2022-05-17 13:08:22 +00:00
|
|
|
expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1_2/srv1 [0-9]*/[0-9]*/-1/-1/[0-9]* -1 .* - - CC-- .* .* \"GET /c2 HTTP/1\\.1\""
|
2021-04-07 12:37:07 +00:00
|
|
|
|
|
|
|
recv
|
2021-06-02 15:23:47 +00:00
|
|
|
expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/<NOSRV> [0-9]*/[0-9]*/-1/-1/[0-9]* -1 .* - - CQ-- .* .* \"GET /c4 HTTP/1\\.1\""
|
2021-04-07 12:37:07 +00:00
|
|
|
barrier b2 sync
|
|
|
|
recv
|
|
|
|
expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe2 be2/srv1 [0-9]*/[0-9]*/[0-9]*/-1/[0-9]* 400 .* - - CH-- .* .* \"GET /c3 HTTP/1\\.1\""
|
|
|
|
} -start
|
|
|
|
|
|
|
|
haproxy h1 -conf {
|
2021-05-09 12:41:41 +00:00
|
|
|
global
|
|
|
|
# WT: limit false-positives causing "HTTP header incomplete" due to
|
|
|
|
# idle server connections being randomly used and randomly expiring
|
|
|
|
# under us.
|
|
|
|
tune.idle-pool.shared off
|
|
|
|
|
2021-04-07 12:37:07 +00:00
|
|
|
defaults
|
|
|
|
mode http
|
|
|
|
option abortonclose
|
2021-11-18 16:15:59 +00:00
|
|
|
retries 1
|
2021-04-07 12:37:07 +00:00
|
|
|
timeout client 10s
|
|
|
|
timeout server 10s
|
|
|
|
timeout connect 100ms
|
|
|
|
timeout queue 5s
|
|
|
|
|
|
|
|
frontend fe1
|
|
|
|
option httplog
|
|
|
|
log ${S_addr}:${S_port} local0 debug err
|
|
|
|
bind "fd@${fe1}"
|
2022-05-17 13:08:22 +00:00
|
|
|
use_backend be1_1 if { path /c1 }
|
|
|
|
use_backend be1_2 if { path /c2 }
|
2021-04-07 12:37:07 +00:00
|
|
|
|
|
|
|
frontend fe2
|
|
|
|
option httplog
|
|
|
|
log ${S_addr}:${S_port} local0 debug err
|
|
|
|
bind "fd@${fe2}"
|
|
|
|
use_backend be2
|
|
|
|
|
2022-05-17 13:08:22 +00:00
|
|
|
backend be1_1
|
|
|
|
server srv1 ${s1_addr}:${s1_port}
|
|
|
|
|
|
|
|
backend be1_2
|
|
|
|
timeout connect 1s
|
|
|
|
retries 10
|
2021-04-07 12:37:07 +00:00
|
|
|
server srv1 ${s1_addr}:${s1_port}
|
|
|
|
|
|
|
|
backend be2
|
|
|
|
server srv1 ${s2_addr}:${s2_port} maxconn 1
|
2022-05-17 13:08:22 +00:00
|
|
|
|
|
|
|
backend check
|
|
|
|
server srv1 ${s1_addr}:${s1_port} check
|
|
|
|
log ${S_addr}:${S_port} local0 debug alert
|
2021-04-07 12:37:07 +00:00
|
|
|
} -start
|
|
|
|
|
2022-05-17 13:08:22 +00:00
|
|
|
# Wait s1 was detected as DOWN
|
|
|
|
barrier b0 sync
|
|
|
|
|
2021-04-07 12:37:07 +00:00
|
|
|
# No server, wait all connection retries : SC--
|
|
|
|
client c1 -connect ${h1_fe1_sock} {
|
|
|
|
txreq -url /c1
|
2021-08-20 09:12:47 +00:00
|
|
|
rxresp
|
|
|
|
expect resp.status == 503
|
2021-04-07 12:37:07 +00:00
|
|
|
} -run
|
|
|
|
|
|
|
|
# Wait c1 log entry
|
|
|
|
barrier b2 sync
|
|
|
|
|
|
|
|
# No server, abort during connections retries : CC--
|
|
|
|
client c2 -connect ${h1_fe1_sock} {
|
|
|
|
txreq -url /c2
|
|
|
|
} -run
|
|
|
|
|
|
|
|
# server with maxconn=1, abort waiting the server reply : CH--
|
|
|
|
client c3 -connect ${h1_fe2_sock} {
|
|
|
|
txreq -url /c3
|
|
|
|
|
|
|
|
# Wait c4 log entry
|
|
|
|
barrier b2 sync
|
|
|
|
} -start
|
|
|
|
|
|
|
|
# server with maxconn=1, abort waiting in the queue (c3 still attached) : CQ--
|
|
|
|
client c4 -connect ${h1_fe2_sock} {
|
|
|
|
# Wait s2 receives c3 request
|
|
|
|
barrier b1 sync
|
|
|
|
|
|
|
|
txreq -url /c4
|
|
|
|
delay .2
|
|
|
|
} -run
|
|
|
|
|
|
|
|
client c3 -wait
|
|
|
|
|
|
|
|
# unlock s2
|
|
|
|
barrier b3 sync
|
|
|
|
|
|
|
|
syslog S -wait
|