]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REGTESTS: complete "del backend" with unnamed defaults ref free
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 2 Mar 2026 07:51:46 +0000 (08:51 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 2 Mar 2026 13:15:53 +0000 (14:15 +0100)
Complete delete backend regtests by checking deletion of a proxy with a
reference on an unnamed defaults instance. This operation is sensible as
the defaults refcount is decremented, and when the last backend is
removed, the defaults is also freed.

reg-tests/proxy/cli_del_backend.vtc

index a78e2c0c3b236d06d302582f7c945a9ea07988a8..4eb17070a7b1dd8db1f4937a1260959fb60d7119 100644 (file)
@@ -25,6 +25,18 @@ haproxy h1 -conf {
 
        backend be
                server s1 ${s1_addr}:${s1_port} disabled
+
+       # Defaults with tcp-check rules in it
+       # Currently this is the only case of runtime ref on an unnamed default
+       defaults
+               mode http
+               timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+               timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
+               timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"
+               option httpchk GET / HTTP/1.1
+
+       backend be_unnamed_def_ref
+       backend be_unnamed_def_ref2
 } -start
 
 haproxy h1 -cli {
@@ -56,3 +68,21 @@ haproxy h1 -cli {
        send "show stat be 2 -1"
        expect !~ "be,BACKEND,"
 }
+
+haproxy h1 -cli {
+       send "show stat be_unnamed_def_ref 2 -1"
+       expect ~ "be_unnamed_def_ref,BACKEND,"
+
+       send "unpublish backend be_unnamed_def_ref;"
+       expect ~ ".*"
+       send "experimental-mode on; del backend be_unnamed_def_ref"
+       expect ~ "Backend deleted."
+
+       send "show stat be_unnamed_def_ref 2 -1"
+       expect !~ "be_unnamed_def_ref,BACKEND,"
+
+       send "unpublish backend be_unnamed_def_ref2;"
+       expect ~ ".*"
+       send "experimental-mode on; del backend be_unnamed_def_ref2"
+       expect ~ "Backend deleted."
+}