On Tue, 2012-07-31 at 12:19 -0400, 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. 

I'm not sure if you are already doing this, but the ssl tests find an
available port using -port 0 and then keep on using it until the end of
the test. There may be a better way to find an available port.

I guess if the broker can't start up with that port (on any time you try
to start it) then the test errors and restarts rather than failing.

This is not a nice way to do it - however I don't know of any way to
reserve tcp ports for your own use reliably. 

Andrew



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to