diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-08-06 00:50:36 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-08-06 00:50:36 +0300 |
commit | 0eb43932b207a6ce70586cb39fa6e55c533f500e (patch) | |
tree | 41935e7c3d5661e22603641c2623e0560d6d74d4 /tests/ratef.at | |
parent | b269c219ded102477601fe77be53caf7d3d58f96 (diff) | |
download | vmod-tbf-0eb43932b207a6ce70586cb39fa6e55c533f500e.tar.gz vmod-tbf-0eb43932b207a6ce70586cb39fa6e55c533f500e.tar.bz2 |
Switch to the new acvmod; remove the --with-varnish-source option; revamp the testsuite
Diffstat (limited to 'tests/ratef.at')
-rw-r--r-- | tests/ratef.at | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/ratef.at b/tests/ratef.at new file mode 100644 index 0000000..d0dc7ea --- /dev/null +++ b/tests/ratef.at @@ -0,0 +1,61 @@ +# This file is part of vmod-tbf +# Copyright (C) 2013-2017 Sergey Poznyakoff +# +# Vmod-tbf is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Vmod-tbf is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([rate flow]) +AT_KEYWORDS([ratef flow]) +AT_VARNISHTEST([tbf],[ + sub vcl_deliver { + set resp.http.result = tbf.rate("url:"+req.url, 1, 1s, 5); + } +], +[ txreq -url "/" + rxresp + expect resp.http.result == true + + txreq -url "/" + rxresp + expect resp.http.result == true + + txreq -url "/" + rxresp + expect resp.http.result == true + + txreq -url "/" + rxresp + expect resp.http.result == true + + txreq -url "/" + rxresp + expect resp.http.result == true + + txreq -url "/" + rxresp + expect resp.http.result == false + + delay 1.0 + + txreq -url "/" + rxresp + expect resp.http.result == true + + txreq -url "/" + rxresp + expect resp.http.result == false +], +[ rxreq + txresp +]) +AT_CLEANUP |