blob: 1b2473d766fb3b5c4809293001eff5b43b1f33ac [file] [log] [blame]
Amaury Denoyelle104b8e52021-08-25 16:24:23 +02001# This script is to check that servers that are referenced by a lua script
2# cannot be removed at runtime.
3varnishtest "Delete lua server via cli"
4
Tim Duesterhus7ba98482021-08-25 19:14:01 +02005feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
6feature cmd "$HAPROXY_PROGRAM -cc 'feature(LUA)'"
Amaury Denoyelle104b8e52021-08-25 16:24:23 +02007feature ignore_unknown_macro
8
Amaury Denoyelle104b8e52021-08-25 16:24:23 +02009server s1 {
10 rxreq
11 txresp
12} -start
13
14haproxy h1 -conf {
15 global
16 lua-load ${testdir}/get_srv_stats.lua
17
18 defaults
19 mode http
20 timeout connect 1s
21 timeout client 1s
22 timeout server 1s
23
24 frontend fe
25 bind "fd@${feS}"
26 default_backend test
27
28 backend test
29 http-request add-header s1-stats %[lua.get_srv_stats(s1)]
30 server s1 ${s1_addr}:${s1_port} # referenced in lua script
31} -start
32
33# make a request to force the execution of the lua script which references a
34# server
35client c1 -connect ${h1_feS_sock} {
36 txreq
37 rxresp
38} -run
39
40haproxy h1 -cli {
41 send "experimental-mode on; del server test/s1"
42 expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
43}