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.


varnishtest "something..."

feature ignore_unknown_macro

server s1 {
        txresp -body "FAILED"
} -start

server s2 {
        txresp -body "SUCCEEDED"
} -start

haproxy ha1 -conf {
        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"
        expect resp.body == "FAILED"

client c2 -connect ${ha1_fe1_sock} {
        txreq -url "/?website=foo"
        expect resp.body == "SUCCEEDED"

client c1 -start
client c2 -start

client c1 -wait
client c2 -wait

Reply via email to