mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-21 03:00:35 +00:00
f673923629
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.
65 lines
2.3 KiB
Plaintext
65 lines
2.3 KiB
Plaintext
varnishtest "Health-checks: some http-check expect tests"
|
|
feature ignore_unknown_macro
|
|
#REQUIRE_VERSION=2.2
|
|
#REGTEST_TYPE=slow
|
|
# This script tests http-check expect rules.
|
|
|
|
server s1 {
|
|
rxreq
|
|
expect req.method == OPTIONS
|
|
expect req.url == /
|
|
expect req.proto == HTTP/1.0
|
|
txresp -status 202 \
|
|
-hdr "x-test1: true, next value" \
|
|
-hdr "x-test2: true, begin-value, value-end, value-sub-string, value-reg-123ABC" \
|
|
-hdr "x-begin-test: 1" \
|
|
-hdr "x-test-end: 1" \
|
|
-hdr "x-sub-test: 1" \
|
|
-hdr "x-reg-test1: 1" \
|
|
-hdr "x-hdr-name: x-test1"
|
|
} -start
|
|
|
|
syslog S1 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv succeeded.*code: 202"
|
|
} -start
|
|
|
|
haproxy h1 -conf {
|
|
defaults
|
|
mode http
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
option log-health-checks
|
|
|
|
backend be1
|
|
log ${S1_addr}:${S1_port} len 2048 local0
|
|
option httpchk
|
|
http-check expect status 200-399
|
|
|
|
http-check expect hdr name "x-test1"
|
|
http-check expect hdr name -m str "X-Test2"
|
|
http-check expect hdr name -m beg "X-Begin-"
|
|
http-check expect hdr name -m end "-End"
|
|
http-check expect hdr name -m sub "-Sub-"
|
|
http-check expect hdr name -m reg "^[a-z]+-Reg-[a-z]+[0-9]\$"
|
|
http-check set-var(check.hdr_name) res.fhdr(x-hdr-name)
|
|
http-check expect hdr name-lf -m str "%[var(check.hdr_name)]"
|
|
http-check expect hdr name-lf -m str "%[res.fhdr(x-hdr-name)]"
|
|
|
|
http-check expect fhdr name "x-test1" value "true, next value"
|
|
http-check expect hdr name "x-test2" value -m str "true"
|
|
http-check expect hdr name -m beg "x-test" value -m beg "begin-"
|
|
http-check expect hdr name -m beg "x-test" value -m end "-end"
|
|
http-check expect hdr name -m beg "x-test" value -m sub "-sub-"
|
|
http-check expect hdr name -m beg "x-test" value -m reg "^value-reg-[A-Z0-9]+\$"
|
|
http-check expect fhdr name -m beg "x-test" value -m reg "value-reg-[A-Z0-9]+"
|
|
http-check set-var(check.hdr_value) str(x-test1)
|
|
http-check expect hdr name -m beg "x-" value-lf -m str "%[var(check.hdr_value)]"
|
|
http-check expect fhdr name -m beg "x-" value-lf -m str "%[res.fhdr(x-hdr-name)]"
|
|
|
|
server srv ${s1_addr}:${s1_port} check inter 100ms rise 1 fall 1
|
|
} -start
|
|
|
|
syslog S1 -wait
|