Hello,
On 07/16/2018 08:47 PM, Robin H. Johnson wrote:
I looked in tests & reg-tests, but didn't see any clear way to add tests
for verifying that fetchers work correctly.
I think my co-worker found an edge-case on smp_fetch_url_param/smp_fetch_param.
Have a look to the attached file to test these sample fetchers.
In this reg-test file we use two servers. s1 replies "FAILED" in its
body, s2 replies "SUCCEEDED".
s2 is used if your ACL is matched, if not this is s1 as default backend
which is used.
I hope this will help.
Regards,
Fred.
varnishtest "something..."
feature ignore_unknown_macro
server s1 {
rxreq
txresp -body "FAILED"
} -start
server s2 {
rxreq
txresp -body "SUCCEEDED"
} -start
haproxy ha1 -conf {
defaults
mode http
timeout connect 20s
timeout client 20ms
timeout server 1s
backend b1
server s1 ${s1_addr}:${s1_port}
backend b2
server s2 ${s2_addr}:${s2_port}
frontend fe1
default_backend b1
bind "fd@${fe1}"
acl bucket_website_crud urlp(website) -m found
use_backend b2 if bucket_website_crud
} -start
client c1 -connect ${ha1_fe1_sock} {
txreq -url "/something"
rxresp
expect resp.body == "FAILED"
}
client c2 -connect ${ha1_fe1_sock} {
txreq -url "/?website=foo"
rxresp
expect resp.body == "SUCCEEDED"
}
client c1 -start
client c2 -start
client c1 -wait
client c2 -wait