I recommend "reserving" a port, chosen at random, in the dynamic port
range:
* 0 - 1023 Well Known Ports
* 1024 - 49151 Registered Ports
* 49152 - 65535 Dynamic and/or Private Ports
(from http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html)
Then, make it persistent: store the port with an appropriate key under
/var/tmp (or your os equivalent), and look for it again at the start of
subsequent test runs.
I tend to think using --port 0 is less good than having the port selection
logic *outside* the daemon. That way you don't have to do any hard work
to discover what the daemon actually chose.
Justin
On Tue, 31 Jul 2012, Alan Conway wrote:
I'm looking for ideas about how to allocate ports for tests.
Our test suite generally runs brokers with --port 0 in order to pick an
available port. That works well in most cases.
The problem case I have is the new HA code. Brokers and clients of a
cluster expect the cluster to have fixed addresses & ports. If I kill
and restart a broker during a test it needs to come up on the same port.
Currently the HA tests use --port 0 and hope for the best, which works
almost all the time. It does however give some spurious test failures,
because some other process grabs the port in the time between stopping
qpidd and restarting it.
Does anyone know a good, simple scheme to allocate ports like this? It
needs to allow multiple test runs on the same host without collisions.
Cheers,
Alan.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]