summaryrefslogtreecommitdiffstats
path: root/reg-tests/server/cli_delete_server_lua.vtc
blob: 396cd21d7c8d0371d5a56bbe1ae07777d00e89b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This script is to check that servers that are referenced by a lua script
# cannot be removed at runtime.
varnishtest "Delete lua server via cli"

feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
feature cmd "$HAPROXY_PROGRAM -cc 'feature(LUA)'"
feature ignore_unknown_macro

server s1 {
	rxreq
	txresp
} -start

haproxy h1 -conf {
	global
		lua-load ${testdir}/get_srv_stats.lua

	defaults
		mode http
		timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
		timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
		timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

	frontend fe
		bind "fd@${feS}"
		default_backend test

	backend test
		http-request add-header s1-stats %[lua.get_srv_stats(s1)]
		server s1 ${s1_addr}:${s1_port}          # referenced in lua script
} -start

# make a request to force the execution of the lua script which references a
# server
client c1 -connect ${h1_feS_sock} {
	txreq
	rxresp
} -run

haproxy h1 -cli {
	send "experimental-mode on; del server test/s1"
	expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
}