haproxy/reg-tests/log/load_balancing.vtc
Willy Tarreau f673923629 REGTESTS: extend the default I/O timeouts and make them overridable
With the CI occasionally slowing down, we're starting to see again some
spurious failures despite the long 1-second timeouts. This reports false
positives that are disturbing and doesn't provide as much value as this
could. However at this delay it already becomes a pain for developers
to wait for the tests to complete.

This commit adds support for the new environment variable
HAPROXY_TEST_TIMEOUT that will allow anyone to modify the connect,
client and server timeouts. It was set to 5 seconds by default, which
should be plenty for quite some time in the CI. All relevant values
that were 200ms or above were replaced by this one. A few larger
values were left as they are special. One test for the set-timeout
action that used to rely on a fixed 1-sec value was extended to a
fixed 5-sec, as the timeout is normally not reached, but it needs
to be known to compare the old and new values.
2021-11-18 17:57:11 +01:00

162 lines
3.4 KiB
Plaintext

varnishtest "Basic log load-balancing test"
feature ignore_unknown_macro
#REQUIRE_VERSION=2.0
barrier b1 cond 2 -cyclic
barrier b2 cond 2 -cyclic
barrier b3 cond 2 -cyclic
barrier b4 cond 2 -cyclic
barrier b5 cond 2 -cyclic
server s1 {
rxreq
txresp
} -repeat 500 -start
syslog Slg_1 -level info {
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c1 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c2 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c3 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c4 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c5 HTTP/1.1\""
} -repeat 50 -start
# Here are the syslog messages received by Slg_2:
syslog Slg_2 -level info {
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c6 HTTP/1.1\""
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* \"GET /client_c8 HTTP/1.1\""
} -repeat 50 -start
haproxy h1 -conf {
global
nbthread 1
defaults
mode http
option httplog
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
frontend fe1
bind "fd@${fe_1}"
log ${Slg_1_addr}:${Slg_1_port} local0
default_backend be
frontend fe2
bind "fd@${fe_2}"
log ${Slg_2_addr}:${Slg_2_port} sample 1,3:5 local0
default_backend be
backend be
server app1 ${s1_addr}:${s1_port}
} -start
# The following client are started in background and synchronized
client c1 -connect ${h1_fe_1_sock} {
txreq -url "/client_c1"
rxresp
expect resp.status == 200
barrier b1 sync
barrier b5 sync
} -repeat 50 -start
client c2 -connect ${h1_fe_1_sock} {
barrier b1 sync
txreq -url "/client_c2"
rxresp
expect resp.status == 200
barrier b2 sync
} -repeat 50 -start
client c3 -connect ${h1_fe_1_sock} {
barrier b2 sync
txreq -url "/client_c3"
rxresp
expect resp.status == 200
barrier b3 sync
} -repeat 50 -start
client c4 -connect ${h1_fe_1_sock} {
barrier b3 sync
txreq -url "/client_c4"
rxresp
expect resp.status == 200
barrier b4 sync
} -repeat 50 -start
client c5 -connect ${h1_fe_1_sock} {
barrier b4 sync
txreq -url "/client_c5"
rxresp
expect resp.status == 200
barrier b5 sync
} -repeat 50 -start
syslog Slg_1 -wait
client c1 -wait
client c2 -wait
client c3 -wait
client c4 -wait
client c5 -wait
# Same test as before but with fe2 frontend.
# The following client are started in background and synchronized
client c6 -connect ${h1_fe_2_sock} {
txreq -url "/client_c6"
rxresp
expect resp.status == 200
barrier b1 sync
barrier b5 sync
} -repeat 50 -start
client c7 -connect ${h1_fe_2_sock} {
barrier b1 sync
txreq -url "/client_c7"
rxresp
expect resp.status == 200
barrier b2 sync
} -repeat 50 -start
client c8 -connect ${h1_fe_2_sock} {
barrier b2 sync
txreq -url "/client_c8"
rxresp
expect resp.status == 200
barrier b3 sync
} -repeat 50 -start
client c9 -connect ${h1_fe_2_sock} {
barrier b3 sync
txreq -url "/client_c9"
rxresp
expect resp.status == 200
barrier b4 sync
} -repeat 50 -start
client c10 -connect ${h1_fe_2_sock} {
barrier b4 sync
txreq -url "/client_c10"
rxresp
expect resp.status == 200
barrier b5 sync
} -repeat 50 -start
syslog Slg_2 -wait
client c6 -wait
client c7 -wait
client c8 -wait
client c9 -wait
client c10 -wait