haproxy/reg-tests/http-set-timeout/set_timeout.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

83 lines
1.8 KiB
Plaintext

varnishtest "http-request set-timeout test"
feature ignore_unknown_macro
#REQUIRE_VERSION=2.4
server srv_h1 -repeat 3 {
rxreq
txresp
} -start
syslog Slog1 -level info {
recv
expect ~ "^.*timeout: 5000 5000.*$"
} -start
syslog Slog2 -level info {
recv
expect ~ "^.*timeout: 5000 5000.*$"
} -start
syslog Slog3 -level info {
recv
expect ~ "^.*timeout: 5000 3000.*$"
} -start
haproxy hap -conf {
defaults
timeout connect 5s
timeout client 5s
timeout server 5s
log global
listen li1
mode http
bind "fd@${li1}"
log-format "timeout: %[be_server_timeout] %[cur_server_timeout]"
log ${Slog1_addr}:${Slog1_port} len 2048 local0 debug err
server srv_h1 ${srv_h1_addr}:${srv_h1_port}
listen li2
mode http
bind "fd@${li2}"
log-format "timeout: %[be_server_timeout] %[cur_server_timeout]"
log ${Slog2_addr}:${Slog2_port} len 2048 local0 debug err
http-request set-timeout server 5s
server srv_h1 ${srv_h1_addr}:${srv_h1_port}
frontend fe1
mode http
bind "fd@${fe1}"
log-format "timeout: %[be_server_timeout] %[cur_server_timeout]"
log ${Slog3_addr}:${Slog3_port} len 2048 local0 debug err
default_backend be1
backend be1
mode http
http-request set-timeout server int(3),mul(1000)
server srv_h1 ${srv_h1_addr}:${srv_h1_port}
} -start
client c1 -connect ${hap_li1_sock} {
txreq
rxresp
expect resp.status == 200
} -run
client c2 -connect ${hap_li2_sock} {
txreq
rxresp
expect resp.status == 200
} -run
client c3 -connect ${hap_fe1_sock} {
txreq
rxresp
expect resp.status == 200
} -run
syslog Slog1 -wait
syslog Slog2 -wait
syslog Slog3 -wait