r2812 - trunk/varnish-cache/bin/varnishtest/tests
phk at projects.linpro.no
phk at projects.linpro.no
Wed Jun 25 23:22:14 CEST 2008
Author: phk
Date: 2008-06-25 23:22:13 +0200 (Wed, 25 Jun 2008)
New Revision: 2812
Added:
trunk/varnish-cache/bin/varnishtest/tests/c00005.vtc
Log:
A simple ACL testcase
Added: trunk/varnish-cache/bin/varnishtest/tests/c00005.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00005.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00005.vtc 2008-06-25 21:22:13 UTC (rev 2812)
@@ -0,0 +1,46 @@
+# $Id$
+
+test "Test simple ACL"
+
+server s1 {
+ rxreq
+ expect req.url == "/"
+ txresp -hdr "Content-Length: 5" -body "1111\n"
+ rxreq
+ expect req.url == "foo"
+ txresp -hdr "Content-Length: 5" -body "2222\n"
+} -start
+
+varnish v1 -vcl+backend {
+ acl acl1 {
+ "127.0.0.1";
+ }
+
+ sub vcl_recv {
+ if (client.ip ~ acl1) {
+ set req.url = "/";
+ }
+ }
+} -start
+
+client c1 {
+ txreq -url "foo"
+ rxresp
+ expect resp.status == 200
+}
+
+client c1 -run
+
+varnish v1 -vcl+backend {
+ acl acl1 {
+ "!127.0.0.1";
+ }
+
+ sub vcl_recv {
+ if (client.ip ~ acl1) {
+ set req.url = "/";
+ }
+ }
+}
+
+client c1 -run
More information about the varnish-commit
mailing list