[PATCH 25/25] Test case for thundering horde algorithm

Martin Blix Grydeland martin at varnish-software.com
Sun Jan 22 18:53:31 CET 2012


---
 bin/varnishtest/tests/t00011.vtc |  130 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 bin/varnishtest/tests/t00011.vtc

diff --git a/bin/varnishtest/tests/t00011.vtc b/bin/varnishtest/tests/t00011.vtc
new file mode 100644
index 0000000..29cb889
--- /dev/null
+++ b/bin/varnishtest/tests/t00011.vtc
@@ -0,0 +1,130 @@
+varnishtest "Test multiple streaming recepients and low token count"
+
+server s1 {
+	rxreq
+	txresp -nolen -hdr "Transfer-encoding: chunked"
+	chunked "<1>------------------------<1>\n"
+	sema r1 sync 5
+	chunked "<2>------------------------<2>\n"
+	sema r2 sync 5
+	chunked "<3>------------------------<3>\n"
+	sema r1 sync 5
+	chunked "<4>------------------------<4>\n"
+	sema r2 sync 5
+	chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+		set beresp.do_stream = true;
+		set beresp.stream_tokens = 1;
+	}
+} -start
+
+client c1 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 124
+} -start
+
+client c2 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 124
+} -start
+
+client c3 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 124
+} -start
+
+client c4 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 124
+} -start
+
+client c1 -wait
+client c2 -wait
+client c3 -wait
+client c4 -wait
+
+varnish v1 -expect fetch_threaded == 1
+varnish v1 -expect s_streamed == 4
-- 
1.7.4.1




More information about the varnish-dev mailing list