blob: ab4200f0c510cbc0f05e3dc54cf8bb91115b1e3e [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
5feature ignore_unknown_macro
6
7#REQUIRE_VERSION=2.5
8#REQUIRE_OPTIONS=LUA
9
10server s1 {
11 rxreq
12 txresp
13} -start
14
15haproxy h1 -conf {
16 global
17 lua-load ${testdir}/get_srv_stats.lua
18
19 defaults
20 mode http
21 timeout connect 1s
22 timeout client 1s
23 timeout server 1s
24
25 frontend fe
26 bind "fd@${feS}"
27 default_backend test
28
29 backend test
30 http-request add-header s1-stats %[lua.get_srv_stats(s1)]
31 server s1 ${s1_addr}:${s1_port} # referenced in lua script
32} -start
33
34# make a request to force the execution of the lua script which references a
35# server
36client c1 -connect ${h1_feS_sock} {
37 txreq
38 rxresp
39} -run
40
41haproxy h1 -cli {
42 send "experimental-mode on; del server test/s1"
43 expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
44}