2021-08-25 14:24:23 +00:00
|
|
|
# This script is to check that servers that are referenced by a lua script
|
|
|
|
# cannot be removed at runtime.
|
|
|
|
varnishtest "Delete lua server via cli"
|
|
|
|
|
2021-08-25 17:14:01 +00:00
|
|
|
feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
|
|
|
|
feature cmd "$HAPROXY_PROGRAM -cc 'feature(LUA)'"
|
2021-08-25 14:24:23 +00:00
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
server s1 {
|
|
|
|
rxreq
|
|
|
|
txresp
|
|
|
|
} -start
|
|
|
|
|
|
|
|
haproxy h1 -conf {
|
|
|
|
global
|
|
|
|
lua-load ${testdir}/get_srv_stats.lua
|
|
|
|
|
|
|
|
defaults
|
|
|
|
mode http
|
2021-11-18 16:46:22 +00:00
|
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
2021-08-25 14:24:23 +00:00
|
|
|
|
|
|
|
frontend fe
|
|
|
|
bind "fd@${feS}"
|
|
|
|
default_backend test
|
|
|
|
|
|
|
|
backend test
|
|
|
|
http-request add-header s1-stats %[lua.get_srv_stats(s1)]
|
|
|
|
server s1 ${s1_addr}:${s1_port} # referenced in lua script
|
|
|
|
} -start
|
|
|
|
|
|
|
|
# make a request to force the execution of the lua script which references a
|
|
|
|
# server
|
|
|
|
client c1 -connect ${h1_feS_sock} {
|
|
|
|
txreq
|
|
|
|
rxresp
|
|
|
|
} -run
|
|
|
|
|
|
|
|
haproxy h1 -cli {
|
|
|
|
send "experimental-mode on; del server test/s1"
|
|
|
|
expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
|
|
|
|
}
|