]> err.no Git - varnish/commitdiff
Add test for simple restarts
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 27 Jun 2008 12:44:47 +0000 (12:44 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 27 Jun 2008 12:44:47 +0000 (12:44 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2853 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/tests/c00009.vtc [new file with mode: 0644]

diff --git a/varnish-cache/bin/varnishtest/tests/c00009.vtc b/varnish-cache/bin/varnishtest/tests/c00009.vtc
new file mode 100644 (file)
index 0000000..2924123
--- /dev/null
@@ -0,0 +1,40 @@
+# $Id$
+
+test "Test restarts"
+
+server s1 {
+       rxreq
+       expect req.url == "/foo"
+       txresp -status 404 
+} -start
+
+server s2 -listen 127.0.0.1:9180 {
+       rxreq
+       expect req.url == "/foo"
+       txresp -body "foobar"
+} -start
+
+varnish v1 -vcl+backend { 
+       sub vcl_recv {
+               if (req.restarts == 0) {
+                       set req.backend = s1;
+               } else {
+                       set req.backend = s2;
+               }
+       }
+
+       sub vcl_fetch {
+               if (obj.status != 200) {
+                       restart;
+               }
+       }
+} -start
+
+client c1 {
+       txreq -url "/foo"
+       rxresp
+       expect resp.status == 200
+       expect resp.http.content-length == 6
+} 
+
+client c1 -run