[master] 2caefd586 Add test missing from the previous commit

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Feb 17 18:54:07 UTC 2020


commit 2caefd58610392a72b56b9ba4a4d727bd9dc5702
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Feb 17 19:51:00 2020 +0100

    Add test missing from the previous commit
    
    Apologies, I wrote this one to have proper coverage of priv_call->free
    functions, and the assertions free_re contains. I forgot to add it to
    the commit...

diff --git a/lib/libvmod_cookie/tests/cookie_v00000.vtc b/lib/libvmod_cookie/tests/cookie_v00000.vtc
new file mode 100644
index 000000000..9c5f097f7
--- /dev/null
+++ b/lib/libvmod_cookie/tests/cookie_v00000.vtc
@@ -0,0 +1,35 @@
+varnishtest "Test priv_call discard"
+
+varnish v1 -cliok "param.set thread_pools 1"
+varnish v1 -vcl {
+	import cookie;
+	backend be none;
+	sub vcl_recv { return (synth(200)); }
+	sub vcl_synth {
+		cookie.set("cookie1", "value1");
+		cookie.set("cookie2", "value2");
+		cookie.set("cookie3", "value3");
+
+		cookie.filter_re("noop");
+		cookie.keep_re("cook");
+		set resp.http.get = cookie.get_re("cookie");
+	}
+} -start
+
+client c1 {
+	txreq -url "/"
+	rxresp
+	expect resp.http.get == value1
+} -run
+
+# load a new VCL to discard the first one
+varnish v1 -vcl {backend be none;}
+varnish v1 -cliok {vcl.discard vcl1}
+
+# tickle the CLI to trigger the effective VCL discard
+varnish v1 -cliok ping
+varnish v1 -expect n_vcl_avail == 1
+varnish v1 -expect n_vcl_discard == 0
+
+# tickle again, check we survived discard-time assertions
+varnish v1 -cliok ping


More information about the varnish-commit mailing list