[master] 91f998e47 Improve VCF coverage

Nils Goroll nils.goroll at uplex.de
Fri Dec 10 16:18:09 UTC 2021


commit 91f998e47e970ebef09d0d23eb5dd83be6bdbe13
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Dec 10 17:17:13 2021 +0100

    Improve VCF coverage

diff --git a/bin/varnishtest/tests/m00051.vtc b/bin/varnishtest/tests/m00051.vtc
index a5231894a..8d2ed69aa 100644
--- a/bin/varnishtest/tests/m00051.vtc
+++ b/bin/varnishtest/tests/m00051.vtc
@@ -12,6 +12,9 @@ varnish v1 -vcl {
 			debug.catflap(first);
 		} else if (req.http.get == "last") {
 			debug.catflap(last);
+		} else if (req.http.novcf) {
+			set req.http.consume = "some workspace";
+			return (pass);
 		} else {
 			return (fail);
 		}
@@ -19,6 +22,10 @@ varnish v1 -vcl {
 	}
 
 	sub vcl_backend_error {
+		if (bereq.http.novcf) {
+			set beresp.status = 206;
+			return (deliver);
+		}
 		if (! bereq.http.id) {
 			return (deliver);
 		}
@@ -27,18 +34,36 @@ varnish v1 -vcl {
 		set beresp.grace = 1m;
 		set beresp.http.id = bereq.http.id;
 	}
+
+	sub vcl_deliver {
+		if (req.http.restart) {
+			unset req.http.restart;
+			unset req.http.id;
+			set req.http.novcf = "yes";
+			return (restart);
+		}
+	}
 } -start
 
 client c1 {
 	txreq -hdr "id: 1"
 	rxresp
 	expect resp.status == 200
+	txreq -hdr "novcf: yes"
+	rxresp
+	expect resp.status == 206
 	txreq -hdr "id: 2"
 	rxresp
 	expect resp.status == 200
+	txreq -hdr "id: 2" -hdr "restart: yes"
+	rxresp
+	expect resp.status == 206
 	txreq -hdr "id: 3"
 	rxresp
 	expect resp.status == 200
+	txreq -hdr "novcf: yes"
+	rxresp
+	expect resp.status == 206
 
 	# the first object is the one which went into cache last
 
@@ -46,9 +71,15 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.http.id == "3"
+	txreq -hdr "novcf: yes"
+	rxresp
+	expect resp.status == 206
 
 	txreq -hdr "get: last"
 	rxresp
 	expect resp.status == 200
 	expect resp.http.id == "1"
+	txreq -hdr "novcf: yes"
+	rxresp
+	expect resp.status == 206
 } -run


More information about the varnish-commit mailing list