aboutsummaryrefslogtreecommitdiff
path: root/tests/test01.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-10-11 14:04:32 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2013-10-11 14:38:21 +0300
commit791cdf412f5fb66a056aa28b27507fdc9af86507 (patch)
tree9e6c4af696424ea72b51d0b8d9c8cf85c8b43856 /tests/test01.at
parentdf83b714395d41b096f7ad8cc3a090c9341f7598 (diff)
downloadvmod-binlog-791cdf412f5fb66a056aa28b27507fdc9af86507.tar.gz
vmod-binlog-791cdf412f5fb66a056aa28b27507fdc9af86507.tar.bz2
Add testsuite.
Diffstat (limited to 'tests/test01.at')
-rw-r--r--tests/test01.at83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/test01.at b/tests/test01.at
new file mode 100644
index 0000000..116c8f1
--- /dev/null
+++ b/tests/test01.at
@@ -0,0 +1,83 @@
+# This file is part of vmod-binlog testsuite -*- autotest -*-
+# Copyright (C) 2013 Sergey Poznyakoff
+#
+# Vmod-binlog 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-binlog 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-binlog. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([appends])
+AT_KEYWORDS([append])
+
+AT_CHECK([
+cwd=`pwd`
+mkdir log
+
+cat > test.vtc <<EOT
+varnishtest "Appends"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ import binlog from "$abs_top_builddir/src/.libs/libvmod_binlog.so";
+ sub vcl_init {
+ binlog.init("dir=$cwd/log;size=1M;pattern=logfile");
+ }
+ sub vcl_fini {
+ binlog.close();
+ }
+ sub vcl_recv {
+ binlog.sappend(req.http.X-nid, req.http.X-aid);
+ return (lookup);
+ }
+} -start
+
+client c1 {
+ txreq -url / -hdr "X-nid:1" -hdr "X-aid:0"
+ rxresp
+ expect resp.status == 200
+
+ txreq -url / -hdr "X-nid:1" -hdr "X-aid:1"
+ rxresp
+ expect resp.status == 200
+
+ delay 1.0
+
+ txreq -url / -hdr "X-nid:2" -hdr "X-aid:0"
+ rxresp
+ expect resp.status == 200
+
+ delay 1.0
+
+ txreq -url / -hdr "X-nid:2" -hdr "X-aid:0"
+ rxresp
+ expect resp.status == 200
+}
+
+client c1 -run
+EOT
+
+$VARNISHTEST test.vtc | sed 's/^#.*TEST test.vtc passed.*/OK/'
+binlogcat -d log/logfile
+],
+[0],
+[OK
+0 1 0
+0 1 1
+1 2 0
+2 2 0
+])
+
+AT_CLEANUP
+

Return to:

Send suggestions and report system problems to the System administrator.