blob: 396cd21d7c8d0371d5a56bbe1ae07777d00e89b2 [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
Willy Tarreauf6739232021-11-18 17:46:22 +010020 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
21 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
22 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Amaury Denoyelle104b8e52021-08-25 16:24:23 +020023
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}