2021-08-23 12:10:51 +00:00
|
|
|
# This script is to test the ability to remove servers, unless they are
|
|
|
|
# referenced by some elements from the configuration.
|
|
|
|
#
|
2021-04-15 12:41:20 +00:00
|
|
|
varnishtest "Delete server via cli"
|
|
|
|
|
2021-08-25 17:14:01 +00:00
|
|
|
feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'"
|
2021-04-15 12:41:20 +00:00
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
haproxy h1 -conf {
|
|
|
|
defaults
|
|
|
|
mode http
|
2021-11-18 16:46:22 +00:00
|
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
2021-04-15 12:41:20 +00:00
|
|
|
|
|
|
|
frontend fe
|
|
|
|
bind "fd@${feS}"
|
2021-08-23 12:10:51 +00:00
|
|
|
acl s1_full srv_sess_rate(test/s1) gt 50
|
2021-04-15 12:41:20 +00:00
|
|
|
default_backend test
|
|
|
|
|
|
|
|
backend test
|
2021-08-23 12:10:51 +00:00
|
|
|
use-server s3 unless { always_false }
|
|
|
|
server s1 ${s1_addr}:${s1_port} # referenced in ACL
|
|
|
|
server s2 ${s1_addr}:${s1_port} check # referenced in track
|
|
|
|
server s3 ${s1_addr}:${s1_port} track s2 # referenced in use-server
|
2021-08-25 14:24:23 +00:00
|
|
|
server s4 ${s1_addr}:${s1_port} # removable server
|
2021-04-15 12:41:20 +00:00
|
|
|
} -start
|
|
|
|
|
|
|
|
haproxy h1 -cli {
|
|
|
|
# non existent backend
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server foo/s1"
|
2021-04-15 12:41:20 +00:00
|
|
|
expect ~ "No such backend."
|
|
|
|
|
|
|
|
# non existent server
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server test/other"
|
2021-04-15 12:41:20 +00:00
|
|
|
expect ~ "No such server."
|
|
|
|
|
2021-08-23 12:10:51 +00:00
|
|
|
# server referenced in ACL
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server test/s1"
|
2021-08-23 12:10:51 +00:00
|
|
|
expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
|
|
|
|
|
|
|
|
# tracked server
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server test/s2"
|
2021-08-23 12:10:51 +00:00
|
|
|
expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
|
|
|
|
|
|
|
|
# tracked server
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server test/s3"
|
2021-08-23 12:10:51 +00:00
|
|
|
expect ~ "This server cannot be removed at runtime due to other configuration elements pointing to it."
|
2021-04-15 12:41:20 +00:00
|
|
|
|
2021-08-25 14:24:23 +00:00
|
|
|
# server in running mode
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server test/s4"
|
2021-04-15 12:41:20 +00:00
|
|
|
expect ~ "Only servers in maintenance mode can be deleted."
|
|
|
|
|
2021-08-25 14:24:23 +00:00
|
|
|
send "disable server test/s4"
|
2021-04-15 12:41:20 +00:00
|
|
|
expect ~ ".*"
|
|
|
|
|
|
|
|
# valid command
|
2022-03-09 14:07:31 +00:00
|
|
|
send "del server test/s4"
|
2021-04-15 12:41:20 +00:00
|
|
|
expect ~ "Server deleted."
|
|
|
|
}
|