Commit a4e07fc5 authored by Federico G. Schwindt's avatar Federico G. Schwindt

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.
parent b5d65c1a
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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment