r3112 - in trunk/varnish-cache/bin/varnishtest: . tests

phk at projects.linpro.no phk at projects.linpro.no
Tue Aug 19 22:48:53 CEST 2008


Author: phk
Date: 2008-08-19 22:48:52 +0200 (Tue, 19 Aug 2008)
New Revision: 3112

Added:
   trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc
Modified:
   trunk/varnish-cache/bin/varnishtest/vtc_http.c
Log:
Add a test-case that exercises the backend-polling a bit.  It does not
really check anything yet, because we lack the stats counters to test.



Added: trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc	2008-08-19 20:48:52 UTC (rev 3112)
@@ -0,0 +1,63 @@
+# $Id: c00016.vtc 3012 2008-07-24 12:22:35Z des $
+
+test "Test Backend Polling"
+
+varnish v1 -vcl { 
+
+	backend foo {
+		.host = "127.0.0.1";
+		.port = "9080";
+		.probe = {
+			.timeout = 1 s;
+			.interval = 0.5 s;
+		}
+	}
+	
+} -start
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -hdr "Bar: foo" -body "foobar" 
+} 
+
+# Handle  probes
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+server s1 -start -wait
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -status 404 -hdr "Bar: foo" -body "foobar" 
+} -start -wait
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -status 200 -hdr "Bar: foo" -body "foobar" 
+} -start -wait
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -proto "FROBOZ" -status 200 -hdr "Bar: foo" -body "foobar" 
+} -start -wait
+
+server s1 {
+} -start -wait
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	delay 2
+} -start -wait
+
+delay 2
+
+varnish v1 -cli "debug.health"

Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c	2008-08-19 20:47:44 UTC (rev 3111)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c	2008-08-19 20:48:52 UTC (rev 3112)
@@ -167,6 +167,15 @@
 			vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
 			    av[0], lhs, av[1], av[2], rhs);
 		}
+	} else if (!strcmp(cmp, "!=")) {
+		if (!strcmp(lhs, rhs)) {
+			vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) failed",
+			    av[0], lhs, av[1], av[2], rhs);
+			exit (1);
+		} else {
+			vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
+			    av[0], lhs, av[1], av[2], rhs);
+		}
 	} else {
 		vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) not implemented",
 		    av[0], lhs, av[1], av[2], rhs);




More information about the varnish-commit mailing list