Improve VCF coverage

parent cb446a38
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment