[PATCH 14/25] Add a couple of streaming test cases
Martin Blix Grydeland
martin at varnish-software.com
Sun Jan 22 18:53:20 CET 2012
---
bin/varnishtest/tests/t00002.vtc | 42 ++++++++++++++++++++++++++++++++++++++
bin/varnishtest/tests/t00003.vtc | 37 +++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 0 deletions(-)
create mode 100644 bin/varnishtest/tests/t00002.vtc
create mode 100644 bin/varnishtest/tests/t00003.vtc
diff --git a/bin/varnishtest/tests/t00002.vtc b/bin/varnishtest/tests/t00002.vtc
new file mode 100644
index 0000000..fa0e8de
--- /dev/null
+++ b/bin/varnishtest/tests/t00002.vtc
@@ -0,0 +1,42 @@
+varnishtest "Test streaming recepient in pass mode"
+
+server s1 {
+ rxreq
+ txresp -nolen -hdr "Transfer-encoding: chunked"
+ chunked "<1>------------------------<1>\n"
+ sema r1 sync 2
+ chunked "<2>------------------------<2>\n"
+ sema r2 sync 2
+ chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_recv {
+ return (pass);
+ }
+
+ sub vcl_fetch {
+ set beresp.do_stream = true;
+ }
+} -start
+
+client c1 {
+ txreq -hdr "foo: /foo"
+ rxresp -no_obj
+
+ rxchunk
+ expect resp.chunklen == 31
+ sema r1 sync 2
+
+ rxchunk
+ expect resp.chunklen == 31
+ sema r2 sync 2
+
+ rxchunk
+ expect resp.chunklen == 0
+ expect resp.bodylen == 62
+} -run
+
+varnish v1 -expect threadgrab_idle == 1
+varnish v1 -expect fetch_threaded == 1
+varnish v1 -expect s_streamed == 1
diff --git a/bin/varnishtest/tests/t00003.vtc b/bin/varnishtest/tests/t00003.vtc
new file mode 100644
index 0000000..76deb2b
--- /dev/null
+++ b/bin/varnishtest/tests/t00003.vtc
@@ -0,0 +1,37 @@
+varnishtest "Test failed streamed delivery not entering cache"
+
+server s1 {
+ rxreq
+ txresp -nolen -hdr "Transfer-encoding: chunked"
+ chunked "<1>------------------------<1>\n"
+ chunked "<2>------------------------<2>\n"
+ accept
+ rxreq
+ txresp -nolen -hdr "Transfer-encoding: chunked"
+ chunked "<1>------------------------<1>\n"
+ chunked "<2>------------------------<2>\n"
+ chunked "<3>------------------------<3>\n"
+ chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_fetch {
+ set beresp.do_stream = true;
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ delay 1
+} -run
+
+client c2 {
+ txreq
+ rxresp
+ expect resp.bodylen == 93
+} -run
+
+varnish v1 -expect threadgrab_idle == 2
+varnish v1 -expect fetch_threaded == 2
+varnish v1 -expect s_streamed == 2
--
1.7.4.1
More information about the varnish-dev
mailing list