[PATCH 3/3] Test case for expiry callbacks

Martin Blix Grydeland martin at varnish-software.com
Thu Feb 26 12:00:24 CET 2015


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

diff --git a/bin/varnishtest/tests/m00021.vtc b/bin/varnishtest/tests/m00021.vtc
new file mode 100644
index 0000000..f13a6fb
--- /dev/null
+++ b/bin/varnishtest/tests/m00021.vtc
@@ -0,0 +1,49 @@
+varnishtest "Test expiry callbacks"
+
+server s1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {} -start
+
+varnish v1 -cliok "param.set debug +vclrel"
+
+logexpect l1 -v v1 -g raw {
+	expect * 0 Debug "exp_cb: registered"
+	expect * 0 Debug "exp_cb: insert 0x[0-9a-f]+"
+	expect * 0 Debug "exp_cb: remove 0x[0-9a-f]+"
+	expect * 0 Debug "exp_cb: deregistered"
+} -start
+
+varnish v1 -vcl+backend {
+	import ${vmod_debug};
+
+	sub vcl_init {
+		debug.register_exp_callback();
+	}
+
+	sub vcl_recv {
+		if (req.method == "PURGE") {
+			return (purge);
+		}
+	}
+}
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+
+	txreq -req PURGE
+	rxresp
+} -run
+varnish v1 -expect n_object == 0
+
+varnish v1 -vcl+backend {}
+varnish v1 -cliok "vcl.discard vcl2"
+varnish v1 -cliok "debug.vmod"
+varnish v1 -cliok "vcl.list"
+varnish v1 -expect vmods == 0
+
+logexpect l1 -wait
-- 
2.1.4




More information about the varnish-dev mailing list