[master] 213a251 A hash_always_miss can override a hit-for-pass

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Mar 9 14:41:05 CET 2017


commit 213a251e7d8f70f5e0e86da38e9e70f8e35d283e
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Mar 9 14:39:20 2017 +0100

    A hash_always_miss can override a hit-for-pass
    
    With a more assertive test this time.

diff --git a/bin/varnishtest/tests/c00082.vtc b/bin/varnishtest/tests/c00082.vtc
index 6d0c27b..65da5ad 100644
--- a/bin/varnishtest/tests/c00082.vtc
+++ b/bin/varnishtest/tests/c00082.vtc
@@ -2,9 +2,15 @@ varnishtest "hash_always_miss overrides hit-for-pass"
 
 server s1 {
 	rxreq
+	expect req.http.Uncacheable == false
 	txresp -hdr "Hit-Pass: forever"
 
 	rxreq
+	expect req.http.Uncacheable == true
+	txresp
+
+	rxreq
+	expect req.http.Uncacheable == false
 	txresp
 } -start
 
@@ -13,6 +19,10 @@ varnish v1 -vcl+backend {
 		set req.hash_always_miss = (req.http.Hash == "always-miss");
 	}
 
+	sub vcl_backend_fetch {
+		set bereq.http.Uncacheable = bereq.uncacheable;
+	}
+
 	sub vcl_backend_response {
 		if (beresp.http.Hit-Pass == "forever") {
 			return (pass(1y));
@@ -24,11 +34,27 @@ varnish v1 -vcl+backend {
 	}
 } -start
 
+logexpect l1 -v v1 -g request {
+	expect * 1001	VCL_return	lookup
+	expect * 1001	VCL_call	MISS
+	expect * 1002	TTL		"^HFP 31536000 "
+	expect * 1003	VCL_return	lookup
+	expect * 1003	VCL_call	PASS
+	expect * 1005	VCL_return	lookup
+	expect * 1005	VCL_call	MISS
+	expect * 1007	VCL_return	lookup
+	expect * 1007	VCL_call	HIT
+} -start
+
 client c1 {
 	txreq
 	rxresp
 	expect resp.http.Obj-Hits == 0
 
+	txreq
+	rxresp
+	expect resp.http.Obj-Hits == 0
+
 	txreq -hdr "Hash: always-miss"
 	rxresp
 	expect resp.http.Obj-Hits == 0
@@ -37,3 +63,5 @@ client c1 {
 	rxresp
 	expect resp.http.Obj-Hits == 1
 } -run
+
+logexpect l1 -wait



More information about the varnish-commit mailing list