mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-11 05:54:39 +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.
169 lines
4.5 KiB
Plaintext
169 lines
4.5 KiB
Plaintext
varnishtest "Health-checks: http-check send test"
|
|
#REGTEST_TYPE=slow
|
|
#REQUIRE_VERSION=2.4
|
|
feature ignore_unknown_macro
|
|
|
|
# This script tests HTTP health-checks and more particularly the "http-check
|
|
# send" directive.
|
|
|
|
server s1 {
|
|
rxreq
|
|
expect req.method == OPTIONS
|
|
expect req.url == /
|
|
expect req.proto == HTTP/1.0
|
|
txresp
|
|
} -start
|
|
|
|
server s2 {
|
|
rxreq
|
|
expect req.method == GET
|
|
expect req.url == /test
|
|
expect req.proto == HTTP/1.1
|
|
expect req.http.connection == "close"
|
|
txresp
|
|
} -start
|
|
|
|
server s3 {
|
|
rxreq
|
|
expect req.method == OPTIONS
|
|
expect req.url == /
|
|
expect req.proto == HTTP/1.0
|
|
expect req.http.hdr == <undef>
|
|
expect req.http.host == <undef>
|
|
expect req.http.x-test == <undef>
|
|
expect req.bodylen == 0
|
|
txresp
|
|
} -start
|
|
|
|
server s4 {
|
|
rxreq
|
|
expect req.method == GET
|
|
expect req.url == /status
|
|
expect req.proto == HTTP/1.1
|
|
expect req.http.connection == "close"
|
|
expect req.http.hdr == <undef>
|
|
expect req.http.host == "my-www-host"
|
|
expect req.http.x-test == true
|
|
expect req.http.content-length == 4
|
|
expect req.bodylen == 4
|
|
expect req.body == "test"
|
|
txresp
|
|
} -start
|
|
|
|
server s5 {
|
|
rxreq
|
|
expect req.method == OPTIONS
|
|
expect req.url == /
|
|
expect req.proto == HTTP/1.0
|
|
expect req.http.hdr == <undef>
|
|
expect req.http.host == "other-www-host"
|
|
expect req.http.x-test == <undef>
|
|
expect req.http.x-new-test == true
|
|
expect req.http.content-length == 10
|
|
expect req.bodylen == 10
|
|
expect req.body == "other test"
|
|
txresp
|
|
} -start
|
|
|
|
server s6 {
|
|
rxreq
|
|
expect req.method == GET
|
|
expect req.url == /
|
|
expect req.proto == HTTP/1.1
|
|
expect req.http.host == "ws-host"
|
|
expect req.http.connection == "upgrade"
|
|
expect req.http.upgrade == "raw-proto"
|
|
txresp \
|
|
-status 101 \
|
|
-hdr "connection: upgrade" \
|
|
-hdr "upgrade: raw-proto"
|
|
} -start
|
|
|
|
|
|
syslog S1 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv succeeded.*code: 200"
|
|
} -start
|
|
|
|
syslog S2 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv succeeded.*code: 200"
|
|
} -start
|
|
|
|
syslog S3 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv succeeded.*code: 200"
|
|
} -start
|
|
|
|
syslog S4 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be4/srv succeeded.*code: 200"
|
|
} -start
|
|
|
|
syslog S5 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be5/srv succeeded.*code: 200"
|
|
} -start
|
|
|
|
syslog S6 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be6_ws/srv succeeded.*code: 101"
|
|
} -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 httpchk
|
|
option log-health-checks
|
|
|
|
backend be1
|
|
log ${S1_addr}:${S1_port} len 2048 local0
|
|
server srv ${s1_addr}:${s1_port} check inter 200ms rise 1 fall 1
|
|
|
|
backend be2
|
|
log ${S2_addr}:${S2_port} len 2048 local0
|
|
option httpchk GET /test HTTP/1.1
|
|
server srv ${s2_addr}:${s2_port} check inter 200ms rise 1 fall 1
|
|
|
|
defaults
|
|
mode http
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
option httpchk GET /status HTTP/1.1\r\nHdr:\ must-be-removed
|
|
option log-health-checks
|
|
http-check send hdr Host "my-www-host" hdr X-test true body "test"
|
|
|
|
backend be3
|
|
option httpchk
|
|
log ${S3_addr}:${S3_port} len 2048 local0
|
|
server srv ${s3_addr}:${s3_port} check inter 200ms rise 1 fall 1
|
|
|
|
backend be4
|
|
log ${S4_addr}:${S4_port} len 2048 local0
|
|
server srv ${s4_addr}:${s4_port} check inter 200ms rise 1 fall 1
|
|
|
|
backend be5
|
|
log ${S5_addr}:${S5_port} len 2058 local0
|
|
http-check send hdr Host "other-www-host" hdr X-New-Test true body "other test"
|
|
server srv ${s5_addr}:${s5_port} check inter 200ms rise 1 fall 1
|
|
|
|
backend be6_ws
|
|
log ${S6_addr}:${S6_port} len 2048 local0
|
|
http-check send meth GET uri / ver HTTP/1.1 hdr host ws-host hdr connection upgrade hdr upgrade raw-proto
|
|
http-check expect status 101
|
|
server srv ${s6_addr}:${s6_port} check inter 200ms rise 1 fall 1
|
|
|
|
} -start
|
|
|
|
syslog S1 -wait
|
|
syslog S2 -wait
|
|
syslog S3 -wait
|
|
syslog S4 -wait
|
|
syslog S5 -wait
|
|
syslog S6 -wait
|