haproxy/reg-tests/mailers/healthcheckmail.vtc
Christopher Faulet 28bc152aa4 REGTESTS: healthcheckmail: Relax matching on the healthcheck log message
Depending on the timing, the conneciton on lisrv listener may be fully
accepted before any reject. Thus, instead of getting a socket error, an
invalid L7 response is reported. There is no reason to be strick on the
error type. Any failure is good here, because we just want to test the
email-alert feature.

This patch should fix issue #1857. It may be backported as far as 2.2.
2022-09-12 10:02:27 +02:00

60 lines
1.5 KiB
Plaintext

varnishtest "Check health-check email alerts"
#REQUIRE_OPTIONS=LUA
feature ignore_unknown_macro
syslog S1 -level notice {
recv
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Health check for server be1/srv1 failed.+check duration: [[:digit:]]+ms.+status: 0/1 DOWN."
recv info
expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Result=SUCCESS Bytes=[[:digit:]]+"
} -start
haproxy h1 -conf {
global
lua-load ${testdir}/healthcheckmail.lua
defaults
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
listen lisrv
mode tcp
bind "fd@${lisrv}"
tcp-request connection reject
listen lismtp
mode tcp
bind "fd@${lismtp}"
log ${S1_addr}:${S1_port} daemon
log-format "Result=%[var(txn.result)] Bytes=%B"
tcp-request content use-service lua.mailservice
frontend fe1
mode http
bind "fd@${fe1}"
default_backend be1
backend be1
mode http
log ${S1_addr}:${S1_port} daemon
option httpchk
option log-health-checks
default-server inter 200ms downinter 100ms rise 1 fall 1
email-alert mailers mymailers
email-alert level info
email-alert from from@domain.tld
email-alert to to@domain.tld
server srv1 ${h1_lisrv_addr}:${h1_lisrv_port} check
mailers mymailers
mailer smtp1 ${h1_lismtp_addr}:${h1_lismtp_port}
} -start
syslog S1 -wait