[PATCH 4/4] Add test cases for overflow handling.

Lasse Karstensen lkarsten at varnish-software.com
Fri Jul 31 09:48:53 CEST 2015


---
 bin/varnishtest/tests/c00070.vtc | 54 ++++++++++++++++++++++++++++++++++++++++
 bin/varnishtest/tests/c00071.vtc | 42 +++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 bin/varnishtest/tests/c00070.vtc
 create mode 100644 bin/varnishtest/tests/c00071.vtc

diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc
new file mode 100644
index 0000000..1ab5bf3
--- /dev/null
+++ b/bin/varnishtest/tests/c00070.vtc
@@ -0,0 +1,54 @@
+varnishtest "Test ws overflow functions in vmod-debug"
+
+server s1 {
+	rxreq
+	txresp
+
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	import ${vmod_debug};
+	sub vcl_backend_response {
+		set beresp.http.free_backend = debug.workspace_free(backend);
+	}
+
+	sub vcl_deliver {
+		set resp.http.free_client = debug.workspace_free(client);
+		set resp.http.free_session = debug.workspace_free(session);
+		set resp.http.free_thread = debug.workspace_free(thread);
+
+		set resp.http.overflowed = debug.workspace_overflowed(client);
+		debug.workspace_allocate(client, 2048);
+
+		if (req.url == "/bar") {
+			debug.workspace_overflow(client);
+		}
+	}
+} -start
+
+logexpect l1 -v v1 -d 1 -g vxid -q "Error ~ 'overflow'" {
+        expect 0 *      Begin
+        expect * =      Error	"workspace_client overflow"
+        expect * =      End
+} -start
+
+client c1 {
+	txreq -url /foo
+	rxresp
+	expect resp.http.overflowed == "false"
+
+	expect resp.http.free_client > 57000
+	expect resp.http.free_backend > 57000
+	expect resp.http.free_session > 250
+	expect resp.http.free_thread > 2000
+} -run
+
+client c2 {
+	txreq -url /bar
+	rxresp
+	expect resp.status == 500
+} -run
+
+logexpect l1 -wait
diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc
new file mode 100644
index 0000000..20e6ad9
--- /dev/null
+++ b/bin/varnishtest/tests/c00071.vtc
@@ -0,0 +1,42 @@
+varnishtest "Test actual client workspace overflow"
+
+server s1 {
+	rxreq
+	txresp
+
+	rxreq
+	txresp
+
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	import ${vmod_debug};
+	sub vcl_deliver {
+		debug.workspace_allocate(client, debug.workspace_free(client) - 278);
+		if (req.url ~ "/bar") {
+			set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+		}
+		else if (req.url ~ "/baz") {
+			set resp.http.x-foo = regsub(req.url, "baz", "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz");
+		}
+	}
+} -start
+
+client c1 {
+	txreq -url /foo
+	rxresp
+	expect resp.status == 200
+
+	txreq -url /bar
+	rxresp
+	expect resp.status == 500
+} -run
+
+client c2 {
+	txreq -url /baz
+	rxresp
+	expect resp.status == 500
+} -run
+
-- 
2.1.4


-- 
Lasse Karstensen
Varnish Software AS



More information about the varnish-dev mailing list