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 | |
| 5 | feature ignore_unknown_macro |
| 6 | |
| 7 | #REQUIRE_VERSION=2.5 |
| 8 | #REQUIRE_OPTIONS=LUA |
| 9 | |
| 10 | server s1 { |
| 11 | rxreq |
| 12 | txresp |
| 13 | } -start |
| 14 | |
| 15 | haproxy 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 |
| 36 | client c1 -connect ${h1_feS_sock} { |
| 37 | txreq |
| 38 | rxresp |
| 39 | } -run |
| 40 | |
| 41 | haproxy 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 | } |