From cff6d757e3ba609c08ef2aaa00f07e53551e5bf6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 3 Jun 2024 07:11:10 +0200 Subject: Adding upstream version 3.0.0. Signed-off-by: Daniel Baumann --- reg-tests/http-rules/http-err-fail.vtc | 84 ++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 reg-tests/http-rules/http-err-fail.vtc (limited to 'reg-tests/http-rules/http-err-fail.vtc') diff --git a/reg-tests/http-rules/http-err-fail.vtc b/reg-tests/http-rules/http-err-fail.vtc new file mode 100644 index 0000000..6d8f9ea --- /dev/null +++ b/reg-tests/http-rules/http-err-fail.vtc @@ -0,0 +1,84 @@ +varnishtest "test for http-err-codes/http-fail-codes redefinitions" + +feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(3.0-dev1)'" +feature ignore_unknown_macro + +server s2 { + rxreq + txresp -status 220 +} -start + +server s3 { + rxreq + txresp -status 300 +} -start + +server s4 { + rxreq + txresp -status 400 +} -start + +server s5 { + rxreq + txresp -status 555 +} -start + + +haproxy h1 -conf { + global + http-err-codes 220 +300-499 -300-399 # only 220, 400-499 remain + http-fail-codes -550-580 +555,599,556-566 + + defaults + mode http + timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" + timeout client "${HAPROXY_TEST_TIMEOUT-5s}" + timeout server "${HAPROXY_TEST_TIMEOUT-5s}" + option socket-stats + + frontend fe + bind "fd@${fe}" + http-request track-sc0 path + http-after-response add-header x-table err=%[sc0_http_err_cnt],fail=%[sc0_http_fail_cnt] + stick-table type string size 100 store http_err_cnt,http_fail_cnt + default_backend be + + backend be + use-server s2 if { path -m beg /2 } + use-server s3 if { path -m beg /3 } + use-server s4 if { path -m beg /4 } + use-server s5 if { path -m beg /5 } + + server s2 ${s2_addr}:${s2_port} + server s3 ${s3_addr}:${s3_port} + server s4 ${s4_addr}:${s4_port} + server s5 ${s5_addr}:${s5_port} +} -start + +client c2 -connect ${h1_fe_sock} { + txreq -url "/2" + rxresp + expect resp.status == 220 + expect resp.http.x-table ~ "err=1,fail=0" +} -run + +client c3 -connect ${h1_fe_sock} { + txreq -url "/3" + rxresp + expect resp.status == 300 + expect resp.http.x-table ~ "err=0,fail=0" +} -run + +client c4 -connect ${h1_fe_sock} { + txreq -url "/4" + rxresp + expect resp.status == 400 + expect resp.http.x-table ~ "err=1,fail=0" +} -run + +client c5 -connect ${h1_fe_sock} { + txreq -url "/5" + rxresp + expect resp.status == 555 + expect resp.http.x-table ~ "err=0,fail=1" +} -run -- cgit v1.2.3