Files
haproxy/reg-tests/proxy/proxy_id.vtc
Amaury Denoyelle b562602044 MEDIUM: cfgparse: acknowledge that proxy ID auto numbering starts at 2
Each frontend/backend/listen proxies is assigned an unique ID. It can
either be set explicitely via 'id' keyword, or automatically assigned on
post parsing depending on the available values.

It was expected that the first automatically assigned value would start
at '1'. However, due to a legacy bug this is not the case as this value
is always skipped. Thus, automatically assigned proxies always start at
'2' or more.

To avoid breaking the current existing state, this situation is now
acknowledged with the current patch. The code is rewritten with an
explicit warning to ensure that this won't be fixed without knowing the
current status. A new regtest also ensures this.
2025-12-23 16:35:49 +01:00

59 lines
1.2 KiB
Plaintext

varnishtest "Ensure that proxies automatic numbering remains consistent across versions"
feature ignore_unknown_macro
# No ID explicitely set. First automatically assigned value must be set to '2'.
# Value '1' is skipped due to an historical bug.
haproxy h1 -conf {
defaults
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
listen fe1
bind "fd@${fe1}"
listen fe2
bind "fd@${fe2}"
} -start
haproxy h1 -cli {
send "show stat 1 -1 -1"
expect !~ "fe[12],"
send "show stat 2 -1 -1"
expect ~ "fe1,"
send "show stat 3 -1 -1"
expect ~ "fe2,"
}
# Explicitely uses ID 1 and 2. First automatically assigned value must be
# set to '3'.
haproxy h2 -conf {
defaults
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
listen fe1
bind "fd@${fe1}"
listen fe2
id 1 # 1 set as automatic value
bind "fd@${fe1}"
listen fe3
id 2
bind "fd@${fe3}"
} -start
haproxy h2 -cli {
send "show stat 1 -1 -1"
expect ~ "fe2,"
send "show stat 2 -1 -1"
expect ~ "fe3,"
send "show stat 3 -1 -1"
expect ~ "fe1,"
}