summaryrefslogtreecommitdiffabout
path: root/tests/test02.vti
Side-by-side diff
Diffstat (limited to 'tests/test02.vti') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/test02.vti49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/test02.vti b/tests/test02.vti
new file mode 100644
index 0000000..1b5e6b3
--- a/dev/null
+++ b/tests/test02.vti
@@ -0,0 +1,49 @@
+varnishtest "Test tbf overlimit"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ import tbf from "${vmod_topbuild}/src/.libs/libvmod_tbf.so";
+ sub vcl_init {
+ tbf.open("${vmod_topbuild}/tests/tbf", "truncate");
+ }
+ sub vcl_fini {
+ tbf.close();
+ }
+ sub vcl_recv {
+ if (!tbf.check("url:"+req.url, "4 req/s")) {
+#VARNISH3# error 420 "Overlimit";
+#VARNISH4# return (synth(420, "Overlimit"));
+ }
+#VARNISH3# return (lookup);
+#VARNISH4# return (hash);
+ }
+} -start
+
+client c1 {
+ txreq -url "/"
+ rxresp
+ expect resp.status == 200
+ txreq -url "/"
+ rxresp
+ expect resp.status == 200
+ txreq -url "/"
+ rxresp
+ expect resp.status == 200
+ txreq -url "/"
+ rxresp
+ expect resp.status == 200
+ txreq -url "/"
+ rxresp
+ expect resp.status == 200
+ txreq -url "/"
+ rxresp
+ expect resp.status == 420
+}
+
+client c1 -run
+
+

Return to:

Send suggestions and report system problems to the System administrator.