Amaury Denoyelle | 104b8e5 | 2021-08-25 16:24:23 +0200 | [diff] [blame] | 1 | # This script is to check that servers that are referenced by a lua script |
| 2 | # cannot be removed at runtime. |
| 3 | varnishtest "Delete lua server via cli" |
| 4 | |
Tim Duesterhus | 7ba9848 | 2021-08-25 19:14:01 +0200 | [diff] [blame^] | 5 | feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'" |
| 6 | feature cmd "$HAPROXY_PROGRAM -cc 'feature(LUA)'" |
Amaury Denoyelle | 104b8e5 | 2021-08-25 16:24:23 +0200 | [diff] [blame] | 7 | feature ignore_unknown_macro |
| 8 | |
Amaury Denoyelle | 104b8e5 | 2021-08-25 16:24:23 +0200 | [diff] [blame] | 9 | server s1 { |
| 10 | rxreq |
| 11 | txresp |
| 12 | } -start |
| 13 | |
| 14 | haproxy 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 |
| 35 | client c1 -connect ${h1_feS_sock} { |
| 36 | txreq |
| 37 | rxresp |
| 38 | } -run |
| 39 | |
| 40 | haproxy 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 | } |