[master] db72da1 Better test coverage of VCC error detection code

Poul-Henning Kamp phk at varnish-cache.org
Mon Jan 31 23:46:57 CET 2011


commit db72da163c401302dd80dd50df0dcf8251b7f29a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 31 22:28:43 2011 +0000

    Better test coverage of VCC error detection code

diff --git a/bin/varnishtest/tests/m00000.vtc b/bin/varnishtest/tests/m00000.vtc
index 7874836..e44dbb2 100644
--- a/bin/varnishtest/tests/m00000.vtc
+++ b/bin/varnishtest/tests/m00000.vtc
@@ -34,3 +34,10 @@ varnish v1 -badvcl {
 		set resp.http.who = std.author(jfk);
 	}
 }
+
+varnish v1 -badvcl {
+	import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so.1" ;
+	sub vcl_deliver {
+		set resp.http.who = std.random("foo", "bar");
+	}
+}
diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index 057dfa7..e584150 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -27,7 +27,7 @@ varnish v1 -vcl {
 
 varnish v1 -badvcl {
 	sub vcl_recv {
-		if (req.restarts == req.url) {
+		if (!req.restarts != req.url) {
 			set req.http.foo = "foo" + 3;
 		}
 
@@ -39,3 +39,31 @@ varnish v1 -badvcl {
 		set req.http.foo = vcl_recv;
 	}
 }
+
+varnish v1 -badvcl {
+	sub vcl_recv {
+		if (req.grace < 3s || req.grace) {
+			set req.http.foo = vcl_recv;
+		}
+	}
+}
+
+varnish v1 -badvcl {
+	sub vcl_recv {
+		if (req.grace < 3s && req.grace) {
+			set req.http.foo = vcl_recv;
+		}
+	}
+}
+
+varnish v1 -badvcl {
+	sub vcl_recv {
+		set req.http.foo = "bla" * "foo";
+	}
+}
+
+varnish v1 -badvcl {
+	sub vcl_fetch {
+		set req.http.foo = req.grace + beresp.status;
+	}
+}
diff --git a/bin/varnishtest/tests/v00033.vtc b/bin/varnishtest/tests/v00033.vtc
index e6e342b..6939855 100644
--- a/bin/varnishtest/tests/v00033.vtc
+++ b/bin/varnishtest/tests/v00033.vtc
@@ -38,3 +38,16 @@ client c1 {
 	expect resp.http.foo == 1100586419201.000
 	expect resp.http.bar == true
 } -run
+
+varnish v1 -badvcl {
+	sub vcl_recv {
+		if (storage.nowhere.free_space > 4 "X") {
+		}
+	}
+}
+varnish v1 -badvcl {
+	sub vcl_recv {
+		if (storage.nowhere.free_space > 4 X) {
+		}
+	}
+}



More information about the varnish-commit mailing list