aboutsummaryrefslogtreecommitdiff
path: root/tests/ratef.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-08-06 00:50:36 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-08-06 00:50:36 +0300
commit0eb43932b207a6ce70586cb39fa6e55c533f500e (patch)
tree41935e7c3d5661e22603641c2623e0560d6d74d4 /tests/ratef.at
parentb269c219ded102477601fe77be53caf7d3d58f96 (diff)
downloadvmod-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.at61
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

Return to:

Send suggestions and report system problems to the System administrator.