[master] cf05817f1 add vtc to check for a ttl = 0s object not replacing a grace object

Nils Goroll nils.goroll at uplex.de
Mon Sep 30 18:53:07 UTC 2019


commit cf05817f1f1b3961e7b055632f07d543a54168aa
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Sep 30 20:43:48 2019 +0200

    add vtc to check for a ttl = 0s object not replacing a grace object
    
    ... to avoid future regressions of a very useful feature.
    
    Using a gap in the test numbers.

diff --git a/bin/varnishtest/tests/b00035.vtc b/bin/varnishtest/tests/b00035.vtc
new file mode 100644
index 000000000..aacb40e62
--- /dev/null
+++ b/bin/varnishtest/tests/b00035.vtc
@@ -0,0 +1,44 @@
+varnishtest "Test grace object not replaced by ttl = 0s"
+
+server s1 {
+	rxreq
+	txresp -bodylen 3
+	rxreq
+	txresp -bodylen 6
+	# bgfetch fails
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		if (req.http.X-Force-Miss) {
+			set req.hash_always_miss = true;
+		}
+	}
+	sub vcl_backend_response {
+		if (beresp.status != 200 || bereq.http.X-Force-Miss) {
+			set beresp.ttl = 0s;
+		} else {
+			set beresp.ttl = 0.001s;
+		}
+		set beresp.grace = 10s;
+		return (deliver);
+	}
+} -start
+
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 3
+
+	txreq -hdr "X-Force-Miss: 1"
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 6
+
+	txreq
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 3
+} -run


More information about the varnish-commit mailing list