mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-16 02:30:46 +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.
107 lines
3.1 KiB
Plaintext
107 lines
3.1 KiB
Plaintext
varnishtest "Health-checks: SMTP health-check"
|
|
#REQUIRE_VERSION=2.2
|
|
#REGTEST_TYPE=slow
|
|
feature ignore_unknown_macro
|
|
|
|
# This scripts tests health-checks for SMTP servers, enabled using
|
|
# "option smtpchk" line.
|
|
|
|
server s1 {
|
|
send "220 smtp-check.vtc SMTP Server\r\n"
|
|
recv 16
|
|
send "250 smtp-check.vtc\r\n"
|
|
} -start
|
|
|
|
server s2 {
|
|
send "220 smtp-check.vtc SMTP Server\r\n"
|
|
recv 17
|
|
send "250-smtp-check.vtc\r\n"
|
|
send "250-KEYWORD\r\n"
|
|
send "250 LAST KEYWORD\r\n"
|
|
} -start
|
|
|
|
server s3 {
|
|
send "I'm not a SMTP server\r\n"
|
|
} -start
|
|
|
|
server s4 {
|
|
send "421 Try again later\r\n"
|
|
} -start
|
|
|
|
server s5 {
|
|
send "220 smtp-check.vtc SMTP Server\r\n"
|
|
recv 16
|
|
send "512 DNS error\r\n"
|
|
} -start
|
|
|
|
syslog S1 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv succeeded, reason: Layer7 check passed.+code: 250.+info: \"smtp-check.vtc\".+check duration: [[:digit:]]+ms, status: 1/1 UP."
|
|
} -start
|
|
|
|
syslog S2 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be2/srv succeeded, reason: Layer7 check passed.+code: 250.+info: \"smtp-check.vtc\".+check duration: [[:digit:]]+ms, status: 1/1 UP."
|
|
} -start
|
|
|
|
syslog S3 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be3/srv failed, reason: Layer7 invalid response.+info: \"I'm not a SMTP server\".+check duration: [[:digit:]]+ms, status: 0/1 DOWN."
|
|
} -start
|
|
|
|
syslog S4 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be4/srv failed, reason: Layer7 wrong status.+code: 421.+info: \"Try again later\".+check duration: [[:digit:]]+ms, status: 0/1 DOWN."
|
|
} -start
|
|
|
|
syslog S5 -level notice {
|
|
recv
|
|
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be5/srv failed, reason: Layer7 wrong status.+code: 512.+info: \"DNS error\".+check duration: [[:digit:]]+ms, status: 0/1 DOWN."
|
|
} -start
|
|
|
|
|
|
haproxy h1 -conf {
|
|
defaults
|
|
mode tcp
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
backend be1
|
|
log ${S1_addr}:${S1_port} daemon
|
|
option log-health-checks
|
|
option smtpchk
|
|
server srv ${s1_addr}:${s1_port} check inter 1s rise 1 fall 1
|
|
|
|
backend be2
|
|
log ${S2_addr}:${S2_port} daemon
|
|
option log-health-checks
|
|
option smtpchk EHLO domain.tld
|
|
server srv ${s2_addr}:${s2_port} check inter 1s rise 1 fall 1
|
|
|
|
backend be3
|
|
log ${S3_addr}:${S3_port} daemon
|
|
option log-health-checks
|
|
option smtpchk
|
|
server srv ${s3_addr}:${s3_port} check inter 1s rise 1 fall 1
|
|
|
|
backend be4
|
|
log ${S4_addr}:${S4_port} daemon
|
|
option log-health-checks
|
|
option smtpchk
|
|
server srv ${s4_addr}:${s4_port} check inter 1s rise 1 fall 1
|
|
|
|
backend be5
|
|
log ${S5_addr}:${S5_port} daemon
|
|
option log-health-checks
|
|
option smtpchk EHLO domain.tld
|
|
server srv ${s5_addr}:${s5_port} check inter 1s rise 1 fall 1
|
|
|
|
} -start
|
|
|
|
syslog S1 -wait
|
|
syslog S2 -wait
|
|
syslog S3 -wait
|
|
syslog S4 -wait
|
|
syslog S5 -wait
|