]> git.kaiwu.me - haproxy.git/commitdiff
REGTESTS: cli: check uninterruptible mode quic-interop
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 9 Nov 2026 13:53:48 +0000 (14:53 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 9 Nov 2026 16:24:53 +0000 (17:24 +0100)
Tests wait command running in uninterruptible mode. The first check
ensures that the limit on concurrent commands cannot be exceeded. The
second check tests the "kill" command.

reg-tests/cli/unintr.vtc [new file with mode: 0644]

diff --git a/reg-tests/cli/unintr.vtc b/reg-tests/cli/unintr.vtc
new file mode 100644 (file)
index 0000000..4505177
--- /dev/null
@@ -0,0 +1,60 @@
+# Test uninterruptible CLI jobs
+
+varnishtest "Test uninterruptible CLI jobs"
+
+feature cmd "command -v socat"
+feature ignore_unknown_macro
+
+haproxy h1 -conf {
+       global
+       .if feature(THREAD)
+               thread-groups 1
+       .endif
+       stats socket "${tmpdir}/h1/stats" level admin
+       stats timeout 10s
+
+       defaults
+               timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
+               timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
+               timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"
+
+       frontend fe_int
+               mode http
+               bind "fd@${fint}"
+               http-request return status 200
+} -start
+
+# wait for haproxy startup
+client c0 -connect ${h1_fint_sock} {
+       txreq
+       rxresp
+} -run
+
+shell {
+       echo "wait -u 1s" | socat -t5 - "${tmpdir}/h1/stats" &
+       echo "wait -u 1s" | socat -t5 - "${tmpdir}/h1/stats" &
+       echo "wait -u 1s" | socat -t5 - "${tmpdir}/h1/stats" &
+       # pause to ensure command parsing has been completed
+    sleep 0.1
+
+       out=$(echo "wait -u 1s" | socat - "${tmpdir}/h1/stats")
+       [ "$out" = "Cannot start a new uninterruptible job." ] || \
+         { echo "expect failure: uninterruptible job limit not respected: ${out}"; exit 1; }
+
+       wait
+}
+
+shell {
+       echo "wait -u 5s" | socat - "${tmpdir}/h1/stats" > "${tmpdir}/h1/out" 2>&1 &
+       # pause to ensure command parsing has been completed
+    sleep 0.1
+
+       out=$(echo "kill unintr" | socat - "${tmpdir}/h1/stats")
+       [ "$out" = "Killed 1 job." ] || \
+         { echo "expect failure: kill command invalid status: ${out}"; exit 1; }
+
+       wait $pid && out=$(cat "${tmpdir}/h1/out")
+       [ "$out" = "Killed." ] || \
+         { echo "expect failure: kill not reported: ${out}"; exit 1; }
+       pid=$!
+}