[PATCH 16/25] Multiple streaming test cases

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


---
 bin/varnishtest/tests/t00004.vtc |   76 +++++++++++++++++++++++++++++++++++++
 bin/varnishtest/tests/t00005.vtc |   77 ++++++++++++++++++++++++++++++++++++++
 bin/varnishtest/tests/t00006.vtc |   57 ++++++++++++++++++++++++++++
 bin/varnishtest/tests/t00007.vtc |   75 +++++++++++++++++++++++++++++++++++++
 4 files changed, 285 insertions(+), 0 deletions(-)
 create mode 100644 bin/varnishtest/tests/t00004.vtc
 create mode 100644 bin/varnishtest/tests/t00005.vtc
 create mode 100644 bin/varnishtest/tests/t00006.vtc
 create mode 100644 bin/varnishtest/tests/t00007.vtc

diff --git a/bin/varnishtest/tests/t00004.vtc b/bin/varnishtest/tests/t00004.vtc
new file mode 100644
index 0000000..e7667e9
--- /dev/null
+++ b/bin/varnishtest/tests/t00004.vtc
@@ -0,0 +1,76 @@
+varnishtest "Test multiple streaming recepients 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
+
+server s2 {
+	rxreq
+	txresp -nolen -hdr "Transfer-encoding: chunked"
+	chunked "<1>------------------------<1>\n"
+	sema r3 sync 2
+	chunked "<2>------------------------<2>\n"
+	sema r4 sync 2
+	chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		if (req.http.client == "c1") {
+			set req.backend = s1;
+		} else {
+			set req.backend = s2;
+		}
+		return (pass);
+	}
+
+	sub vcl_fetch {
+		set beresp.do_stream = true;
+	}
+} -start
+
+client c1 {
+	txreq -hdr "client: c1" -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
+} -start
+
+client c2 {
+	txreq -hdr "client: c2" -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r3 sync 2
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r4 sync 2
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 62
+} -start
+
+client c1 -wait
+client c2 -wait
+
+varnish v1 -expect fetch_threaded == 2
+varnish v1 -expect s_streamed == 2
diff --git a/bin/varnishtest/tests/t00005.vtc b/bin/varnishtest/tests/t00005.vtc
new file mode 100644
index 0000000..d6fc47a
--- /dev/null
+++ b/bin/varnishtest/tests/t00005.vtc
@@ -0,0 +1,77 @@
+varnishtest "Test multiple streaming recepients in hit-for-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
+
+server s2 {
+	rxreq
+	txresp -nolen -hdr "Transfer-encoding: chunked"
+	chunked "<1>------------------------<1>\n"
+	sema r3 sync 2
+	chunked "<2>------------------------<2>\n"
+	sema r4 sync 2
+	chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		if (req.http.client == "c1") {
+			set req.backend = s1;
+		} else {
+			set req.backend = s2;
+		}
+		return (pass);
+	}
+
+	sub vcl_fetch {
+		set beresp.do_stream = true;
+		return (hit_for_pass);
+	}
+} -start
+
+client c1 {
+	txreq -hdr "client: c1" -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
+} -start
+
+client c2 {
+	txreq -hdr "client: c2" -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r3 sync 2
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r4 sync 2
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 62
+} -start
+
+client c1 -wait
+client c2 -wait
+
+varnish v1 -expect fetch_threaded == 2
+varnish v1 -expect s_streamed == 2
diff --git a/bin/varnishtest/tests/t00006.vtc b/bin/varnishtest/tests/t00006.vtc
new file mode 100644
index 0000000..76fd8ca
--- /dev/null
+++ b/bin/varnishtest/tests/t00006.vtc
@@ -0,0 +1,57 @@
+varnishtest "Test multiple streaming recepients"
+
+server s1 {
+	rxreq
+	txresp -nolen -hdr "Transfer-encoding: chunked"
+	chunked "<1>------------------------<1>\n"
+	sema r1 sync 3
+	chunked "<2>------------------------<2>\n"
+	sema r2 sync 3
+	chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+	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 3
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 3
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 62
+} -start
+
+client c2 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 3
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r2 sync 3
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 62
+} -start
+
+client c1 -wait
+client c2 -wait
+
+varnish v1 -expect fetch_threaded == 1
+varnish v1 -expect s_streamed == 2
diff --git a/bin/varnishtest/tests/t00007.vtc b/bin/varnishtest/tests/t00007.vtc
new file mode 100644
index 0000000..bd3f0ed
--- /dev/null
+++ b/bin/varnishtest/tests/t00007.vtc
@@ -0,0 +1,75 @@
+varnishtest "Test multiple rushing of waiting list when streaming"
+
+server s1 {
+	rxreq
+	txresp -nolen -hdr "Transfer-encoding: chunked"
+	chunked "<1>------------------------<1>\n"
+	sema r1 sync 5
+	chunkedlen 0
+} -start
+
+varnish v1 -arg "-p rush_exponent=2" -vcl+backend {
+	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 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 31
+} -start
+
+client c2 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 31
+} -start
+
+client c3 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 31
+} -start
+
+client c4 {
+	txreq -hdr "foo: /foo"
+	rxresp -no_obj
+
+	rxchunk
+	expect resp.chunklen == 31
+	sema r1 sync 5
+
+	rxchunk
+	expect resp.chunklen == 0
+	expect resp.bodylen == 31
+} -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