| # 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" |
| |
| feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'" |
| feature cmd "$HAPROXY_PROGRAM -cc 'feature(LUA)'" |
| feature ignore_unknown_macro |
| |
| server s1 { |
| rxreq |
| txresp |
| } -start |
| |
| haproxy h1 -conf { |
| global |
| lua-load ${testdir}/get_srv_stats.lua |
| |
| defaults |
| mode http |
| timeout connect 1s |
| timeout client 1s |
| timeout server 1s |
| |
| 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." |
| } |