Re: [PATCH 2/3] test-lib-functions: introduce the 'test_set_port' helper function
- Date: Wed, 5 Dec 2018 16:59:59 -0500
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: [PATCH 2/3] test-lib-functions: introduce the 'test_set_port' helper function
On Wed, Dec 05, 2018 at 01:20:35PM +0100, SZEDER Gábor wrote:
> On Wed, Dec 05, 2018 at 12:17:09AM -0500, Jeff King wrote:
> > On Tue, Dec 04, 2018 at 05:34:56PM +0100, SZEDER Gábor wrote:
> > > Several test scripts run daemons like 'git-daemon' or Apache, and
> > > communicate with them through TCP sockets. To have unique ports where
> > > these daemons are accessible, the ports are usually the number of the
> > > corresponding test scripts, unless the user overrides them via
> > > environment variables, and thus all those tests and test libs contain
> > > more or less the same bit of one-liner boilerplate code to find out
> > > the port. The last patch in this series will make this a bit more
> > > complicated.
> > >
> > > Factor out finding the port for a daemon into the common helper
> > > function 'test_set_port' to avoid repeating ourselves.
> > OK. Looks like this should keep the same port numbers for all of the
> > existing tests, which I think is good.
> Not for all existing tests, though: t0410 and the 'git p4' tests do
> get different ports.
Yeah, I should have said "most". The important thing is that they remain
static and predictable for normal non-stress runs, which they do.