[master] e1f7207 Try to make this test more robust

Poul-Henning Kamp phk at varnish-cache.org
Mon Oct 22 09:21:00 CEST 2012


commit e1f72076cbd9a0262d0f79362892f4e9299636f4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 22 07:20:26 2012 +0000

    Try to make this test more robust

diff --git a/bin/varnishtest/tests/v00006.vtc b/bin/varnishtest/tests/v00006.vtc
index 494007f..31018e9 100644
--- a/bin/varnishtest/tests/v00006.vtc
+++ b/bin/varnishtest/tests/v00006.vtc
@@ -1,23 +1,32 @@
 varnishtest "VCL: Test backend retirement"
+#
+# This case is quite sensitive to ordering of the worker threads because
+# it has so little actual traffic.  In a real world setting, this should
+# not be an issue.
+#
 
 # First do one request to get a work-thread that holds a VCL reference
 
 server s1 {
 	rxreq
+	expect req.url == "/bar"
 	txresp
 } -start
 
 # Only one pool, to avoid getting more than one work thread
-varnish v1 -arg "-p thread_pools=1" -vcl+backend {
-} -start
+varnish v1 -arg "-p thread_pools=1" -vcl+backend { } -start
+
+# Give the varnishd a chance to start and create workers etc.
+# NB: This is important for to avoid mis-ordering of the workers.
+delay 1
 
 client c1 {
-	txreq
+	txreq -url /bar
 	rxresp
-} -start
+	expect resp.status == 200
+} -run
 
 server s1 -wait
-client c1 -wait
 
 varnish v1 -expect n_backend == 1
 varnish v1 -expect n_vcl_avail == 1
@@ -27,6 +36,7 @@ varnish v1 -expect n_vcl_discard == 0
 
 server s2 {
 	rxreq
+	expect req.url == "/foo"
 	txresp
 } -start
 
@@ -59,8 +69,11 @@ varnish v1 -expect n_vcl_discard == 1
 client c1 {
 	txreq -url /foo
 	rxresp
+	expect resp.status == 200
 } -run
 
+server s2 -wait
+
 # The workthread should have released its VCL reference now
 # but we need to tickle the CLI to notice
 



More information about the varnish-commit mailing list