REGTESTS: server: test SSL/PROXY with checks for dynamic servers

Complete the dynamic servers regtest to ensure there is no implicit
interaction for checks and SSL/PROXY server settings.
This commit is contained in:
Amaury Denoyelle 2022-03-09 16:43:34 +01:00
parent 7d098bea2b
commit 3881e1775d
2 changed files with 88 additions and 0 deletions

View File

@ -48,6 +48,18 @@ syslog S1 -level notice {
barrier b1 sync
barrier b2 sync
recv
expect ~ ".*Server be1/s4 is UP/READY \\(leaving forced maintenance\\)."
recv
expect ~ "Health check for server be1/s4 failed"
barrier b1 sync
recv
expect ~ ".*Server be1/s5 is UP/READY \\(leaving forced maintenance\\)."
recv
expect ~ "Health check for server be1/s5 succeeded."
} -start
haproxy h1 -conf {
@ -58,6 +70,11 @@ haproxy h1 -conf {
option log-health-checks
option httpchk GET /
log ${S1_addr}:${S1_port} daemon
frontend fe-proxy
mode http
bind "fd@${hapsrv}" accept-proxy
http-request return status 200
} -start
# check on a functional server
@ -117,4 +134,28 @@ haproxy h1 -cli {
expect ~ "Server deleted."
}
# check PROXY protocol interaction with checks
haproxy h1 -cli {
# no explicit check-send-proxy
# The health check should failed.
send "add server be1/s4 ${h1_hapsrv_addr}:${h1_hapsrv_port} send-proxy check rise 1 fall 1"
expect ~ "New server registered."
send "enable server be1/s4"
expect ~ ".*"
send "enable health be1/s4"
expect ~ ".*"
barrier b1 sync
# explicit check-send-proxy : health check should succeeded
send "add server be1/s5 ${h1_hapsrv_addr}:${h1_hapsrv_port} send-proxy check rise 1 fall 1 check-send-proxy"
expect ~ "New server registered."
send "enable server be1/s5"
expect ~ ".*"
send "enable health be1/s5"
expect ~ ".*"
}
syslog S1 -wait

View File

@ -5,6 +5,24 @@ feature cmd "$HAPROXY_PROGRAM -cc 'feature(OPENSSL)'"
feature cmd "command -v socat"
feature ignore_unknown_macro
barrier b1 cond 2 -cyclic
syslog S1 -level notice {
recv
expect ~ ".*Server li-ssl/s1 is UP/READY \\(leaving forced maintenance\\)."
recv
expect ~ ".*Server li-ssl/s2 is UP/READY \\(leaving forced maintenance\\)."
recv
expect ~ "Health check for server li-ssl/s2 failed"
barrier b1 sync
recv
expect ~ ".*Server li-ssl/s3 is UP/READY \\(leaving forced maintenance\\)."
recv
expect ~ "Health check for server li-ssl/s3 succeeded."
} -start
haproxy h1 -conf {
global
stats socket "${tmpdir}/h1/stats" level admin
@ -14,11 +32,14 @@ haproxy h1 -conf {
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
option log-health-checks
option httpchk GET /
# proxy to attach a ssl server
listen li-ssl
bind "fd@${feSsl}"
balance random
log ${S1_addr}:${S1_port} daemon
# frontend used to respond to ssl connection
frontend fe-ssl-term
@ -61,3 +82,29 @@ client c2 -connect ${h1_feSsl_sock} {
rxresp
expect resp.status == 200
} -run
# test interaction between SSL and checks for dynamic servers
haproxy h1 -cli {
# no explicit check-ssl
# The health check should failed.
send "add server li-ssl/s2 ${h1_feSslTerm_addr}:${h1_feSslTerm_port} ssl verify none check"
expect ~ "New server registered."
send "enable server li-ssl/s2"
expect ~ ".*"
send "enable health li-ssl/s2"
expect ~ ".*"
barrier b1 sync
# explicit check-ssl : health check should succeeded
send "add server li-ssl/s3 ${h1_feSslTerm_addr}:${h1_feSslTerm_port} ssl verify none check check-ssl"
expect ~ "New server registered."
send "enable server li-ssl/s3"
expect ~ ".*"
send "enable health li-ssl/s3"
expect ~ ".*"
}
syslog S1 -wait