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

Forgot to git add this one some days ago

parent a1a62dc7
# $Id$
test "test vmod_std.duration conversion"
server s1 {
rxreq
expect req.url == "/1"
txresp -bodylen 1
} -start
varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
sub vcl_recv {
set req.ttl = 1000000s + std.duration(req.http.ttl, 1s);
}
sub vcl_deliver {
set resp.http.ttl = (req.ttl + 1s);
}
} -start
client c1 {
txreq -url "/1" -hdr "ttl: 10s "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000011.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 10m "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000601.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 10h "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1036001.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 10d "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1864001.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 10w "
rxresp
expect resp.status == 200
expect resp.http.ttl == 7048001.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: -100s "
rxresp
expect resp.status == 200
expect resp.http.ttl == 999901.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: s "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000002.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 3wx "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000002.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: -inf "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000002.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 2x "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000002.000
expect resp.bodylen == 1
txreq -url "/1" -hdr "ttl: 2h x "
rxresp
expect resp.status == 200
expect resp.http.ttl == 1000002.000
expect resp.bodylen == 1
} -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