[master] a4e07fc Correct this test for good

Federico G. Schwindt fgsch at lodoss.net
Sat Jan 28 19:03:04 CET 2017


commit a4e07fc5a611062afddd2fb114d43d793054c15f
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sat Jan 28 14:38:50 2017 +0000

    Correct this test for good
    
    (Ab)use the bound address used for the bad_backend macro to expose a
    random port and avoid the dreaded collisions.

diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc
index 01adffd..7f271cd 100644
--- a/bin/varnishtest/tests/c00003.vtc
+++ b/bin/varnishtest/tests/c00003.vtc
@@ -1,9 +1,9 @@
 varnishtest "Check that we fail to start with erroneous -a/-b arguments"
 
 # Duplicate -a arguments
-# XXX: this cannot be tested reliably, we tolerate port collision
-shell -err -match "have same address|already in use" {
-	varnishd -d -a 127.0.0.1:38484 -a 127.0.0.1:38484 -b localhost:80
+shell -err -expect "have same address" {
+	varnishd -d -a 127.0.0.1:${random_port} \
+		-a 127.0.0.1:${random_port} -b localhost:80
 }
 
 # -a bad protocol specs
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index c18f355..29eec9c 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -499,6 +499,9 @@ ip_magic(void)
 	/* Expose a backend that is forever down. */
 	extmacro_def("bad_backend", "%s %s", abuf, pbuf);
 
+	/* Expose a port that ought to be free */
+	extmacro_def("random_port", "%s", pbuf);
+
 	/*
 	 * We need an IP number which will not repond, ever, and that is a
 	 * lot harder than it sounds.  This IP# is from RFC5737 and a



More information about the varnish-commit mailing list