r2853 - trunk/varnish-cache/bin/varnishtest/tests

phk at projects.linpro.no phk at projects.linpro.no
Fri Jun 27 14:44:47 CEST 2008


Author: phk
Date: 2008-06-27 14:44:47 +0200 (Fri, 27 Jun 2008)
New Revision: 2853

Added:
   trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc
Log:
Add test for simple restarts



Added: trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc	2008-06-27 12:44:47 UTC (rev 2853)
@@ -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




More information about the varnish-commit mailing list