-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
condfetch: Demote to fetch for dying stale_oc
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
varnishtest "Demote condfetch to fetch on invalidated stale object" | ||
|
||
barrier b1 sock 2 | ||
barrier b2 sock 2 | ||
|
||
server s1 { | ||
rxreq | ||
txresp -hdr {ETag: "foo"} -body corrupted | ||
|
||
rxreq | ||
expect req.http.If-None-Match == <undef> | ||
txresp -hdr {ETag: "foo"} -body valid | ||
} -start | ||
|
||
varnish v1 -vcl+backend { | ||
import vtc; | ||
sub vcl_recv { | ||
if (req.method == "PURGE") { | ||
return (purge); | ||
} | ||
} | ||
sub vcl_miss { | ||
if (req.http.sync) { | ||
vtc.barrier_sync("${b1_sock}"); | ||
vtc.barrier_sync("${b2_sock}"); | ||
} | ||
} | ||
sub vcl_backend_response { | ||
set beresp.ttl = 1ms; | ||
set beresp.grace = 0s; | ||
set beresp.keep = 10s; | ||
} | ||
sub vcl_deliver { | ||
set resp.http.obj-hits = obj.hits; | ||
} | ||
} -start | ||
|
||
client c1 { | ||
txreq | ||
rxresp | ||
expect resp.body == corrupted | ||
expect resp.http.obj-hits == 0 | ||
|
||
delay 0.1 | ||
|
||
txreq -hdr "sync: true" | ||
rxresp | ||
expect resp.body == valid | ||
expect resp.http.obj-hits == 0 | ||
} -start | ||
|
||
barrier b1 sync | ||
client c2 { | ||
txreq -req PURGE | ||
rxresp | ||
} -run | ||
barrier b2 sync | ||
|
||
client c1 -wait |