Commit 24870927 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make this test more robust.

parent e6e697ca
varnishtest "Test requests other than GET are cacheable"
barrier b1 cond 2
server s1 {
rxreq
expect req.method == "POST"
......@@ -9,14 +11,22 @@ server s1 {
expect req.method == "POST"
expect req.body == "foo"
txresp -body baz
barrier b1 sync
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
# We ignore the actual body for this test.
set req.http.method = req.method;
set req.http.hit = "No";
return (hash);
}
sub vcl_hit {
set req.http.hit = "Yes";
}
sub vcl_deliver {
set resp.http.hit = req.http.hit;
}
sub vcl_backend_fetch {
set bereq.method = bereq.http.method;
}
......@@ -29,14 +39,27 @@ client c1 {
txreq -req "POST" -body "foo"
rxresp
expect resp.body == "bar"
expect resp.http.hit == "No"
txreq -req "POST" -body "foo"
rxresp
expect resp.body == "bar"
delay 0.5
expect resp.http.hit == "Yes"
# Wait until between ttl&grace
delay 1.0
# Trigger bg fetch
txreq -req "POST" -body "foo"
rxresp
expect resp.body == "bar"
expect resp.http.hit == "Yes"
barrier b1 sync
# Get new object, from cache
txreq -req "POST" -body "foo"
rxresp
expect resp.body == "baz"
expect resp.http.hit == "Yes"
} -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