[PATCH 6/7] Add a test case for ban list syncing across silos

Martin Blix Grydeland martin at varnish-software.com
Mon Dec 3 11:09:54 CET 2012


---
 bin/varnishtest/tests/p00008.vtc |   80 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 bin/varnishtest/tests/p00008.vtc

diff --git a/bin/varnishtest/tests/p00008.vtc b/bin/varnishtest/tests/p00008.vtc
new file mode 100644
index 0000000..e2ab62f
--- /dev/null
+++ b/bin/varnishtest/tests/p00008.vtc
@@ -0,0 +1,80 @@
+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
-- 
1.7.10.4




More information about the varnish-dev mailing list