Commit 0296c844 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Add a test case for ban list syncing across silos

parent 679fe13a
varnishtest "Ban list sync across silos"
shell "rm -f ${tmpdir}/_.per[12]"
# Silo 1 & 2
# Prime each with an object with X-Foo: foo
server s1 {
rxreq
expect req.url == "/silo1"
txresp -hdr "X-Foo: foo"
rxreq
expect req.url == "/silo2"
txresp -hdr "X-Foo: foo"
} -start
varnish v1 \
-arg "-pfeature=+wait_silo" \
-arg "-pban_lurker_sleep=0" \
-storage "-sper1=persistent,${tmpdir}/_.per1,10m -sper2=persistent,${tmpdir}/_.per2,10m" \
-vcl+backend {
sub vcl_fetch {
set beresp.storage = "per1";
if (req.url ~ "silo2") {
set beresp.storage = "per2";
}
}
} -start
client c1 {
txreq -url "/silo1"
rxresp
expect resp.status == 200
expect resp.http.x-foo == "foo"
txreq -url "/silo2"
rxresp
expect resp.status == 200
expect resp.http.x-foo == "foo"
} -run
varnish v1 -stop
server s1 -wait
# Only silo 1
# Ban on obj.http.x-foo == foo
varnish v2 \
-arg "-pfeature=+wait_silo" \
-arg "-pban_lurker_sleep=0" \
-storage "-spersistent,${tmpdir}/_.per1,10m" \
-vcl+backend { } -start
varnish v2 -cliok "ban obj.http.x-foo == foo"
varnish v2 -cliok "ban.list"
varnish v2 -stop
# Silo 1 & 2
# Bans should be transferred
varnish v3 \
-arg "-pfeature=+wait_silo" \
-arg "-pban_lurker_sleep=0" \
-storage "-spersistent,${tmpdir}/_.per1,10m -spersistent,${tmpdir}/_.per2,10m" \
-vcl+backend { } -start
varnish v3 -cliok "ban.list"
varnish v3 -stop
# Only silo 2
# Check that /silo2 is banned
server s1 {
rxreq
expect req.url == "/silo2"
txresp -hdr "X-Foo: bar"
} -start
varnish v4 \
-arg "-pfeature=+wait_silo" \
-arg "-pban_lurker_sleep=0" \
-storage "-spersistent,${tmpdir}/_.per2,10m" \
-vcl+backend { } -start
client c1 -connect ${v4_sock} {
txreq -url "/silo2"
rxresp
expect resp.status == 200
expect resp.http.x-foo == "bar"
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment