You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Alan Conway (JIRA)" <qp...@incubator.apache.org> on 2007/05/30 20:50:15 UTC

[jira] Created: (QPID-504) Dynamic port for automated tests.

Dynamic port for automated tests.
---------------------------------

                 Key: QPID-504
                 URL: https://issues.apache.org/jira/browse/QPID-504
             Project: Qpid
          Issue Type: Test
          Components: C++ Broker
            Reporter: Alan Conway


As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 

Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
a port that is guaranteed not to be used by any other test on the same host.

One way to do this:
- add qpidd --print-port option to print the actual bound port
- add qpid option processing to qpid client library, enable in all test programs. 
- test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by Alan Conway <ac...@redhat.com>.
On Fri, 2007-06-08 at 07:30 +0100, Mark Atwell wrote:
> bind(0) will give you an arbitrary port - which is what you want, but
> there's a slim danger of acquiring a port that another daemon (not currently
> running) explicitly requires. By allowing the specification of a range at
> least means you have some control to facilitate avoidance.
> 
> Stuffed daemon goes perfectly with a fine Port (ho ho!)

Hee hee! I'm going to commit --print-port today, I'm not touching the
bind code. I think "--port 0 --print-port" is sufficient for most
testing needs, certainly for mine.

If you think port ranges are a worthwhile feature, mail me the text for
a new JIRA and I'll create it on your behalf.

Cheers,
Alan.


Re: [jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by Mark Atwell <ma...@gmail.com>.
bind(0) will give you an arbitrary port - which is what you want, but
there's a slim danger of acquiring a port that another daemon (not currently
running) explicitly requires. By allowing the specification of a range at
least means you have some control to facilitate avoidance.

Stuffed daemon goes perfectly with a fine Port (ho ho!)

Cheers

Mark


On 6/7/07, Alan Conway <ac...@redhat.com> wrote:
>
> On Tue, 2007-06-05 at 21:16 +0100, Mark Atwell wrote:
> > I would suggest favouring a range of ports - possibly trying one at a
> time,
> > bind(0) has the chance of stuffing other perfectly honourable daemons
> (if
> > that isn't an oxymoron! :o) Of course, in turn the range could be
> > configurable from 0 thru 64K if necessary.
> >
> I've worked lots with bind(0) servers and didn't have any stuffed
> daemons (sounds delicious though.) What were the circumstances of
> aforementioned daemon stuffing? All I'm looking for is a simple way to
> run several copies of a test suite simultaneously on the same host
> without confusion daemons.
>
> Cheers,
> Alan.
>
>
>

Re: [jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by Alan Conway <ac...@redhat.com>.
On Tue, 2007-06-05 at 21:16 +0100, Mark Atwell wrote:
> I would suggest favouring a range of ports - possibly trying one at a time,
> bind(0) has the chance of stuffing other perfectly honourable daemons (if
> that isn't an oxymoron! :o) Of course, in turn the range could be
> configurable from 0 thru 64K if necessary.
> 
I've worked lots with bind(0) servers and didn't have any stuffed
daemons (sounds delicious though.) What were the circumstances of
aforementioned daemon stuffing? All I'm looking for is a simple way to
run several copies of a test suite simultaneously on the same host
without confusion daemons. 

Cheers,
Alan.



Re: [jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by Mark Atwell <ma...@gmail.com>.
I would suggest favouring a range of ports - possibly trying one at a time,
bind(0) has the chance of stuffing other perfectly honourable daemons (if
that isn't an oxymoron! :o) Of course, in turn the range could be
configurable from 0 thru 64K if necessary.

M


On 6/5/07, John O'Hara (JIRA) <qp...@incubator.apache.org> wrote:
>
>
>    [
> https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501563]
>
> John O'Hara commented on QPID-504:
> ----------------------------------
>
> I've not run the C qpidd (shame on me); is it in the tradition of a 100%
> silent daemon, or does it print startup messages?
>
> If the latter, it could always print out the port number in the same place
> everytime....along with other pertinent info like version numbers and
> whether or not the server is running with default security.
>
> Both the C and Java brokers should behave in the same way and accept the
> same command line options (where that makes sense).
>
> Thoughts?
> John
>
> > Dynamic port for automated tests.
> > ---------------------------------
> >
> >                 Key: QPID-504
> >                 URL: https://issues.apache.org/jira/browse/QPID-504
> >             Project: Qpid
> >          Issue Type: Test
> >          Components: C++ Broker
> >            Reporter: Alan Conway
> >
> > As development ramps up we will have multiple qpid builds on the same
> machine clashing for use of the AMQP default port.
> > All automated tests should use a *dynamically assigned* (i.e. bind(0))
> port.
> > Allowing a manually specified port number for tests doesn't solve the
> problem as there's no way to choose
> > a port that is guaranteed not to be used by any other test on the same
> host.
> > One way to do this:
> > - add qpidd --print-port option to print the actual bound port
> > - add qpid option processing to qpid client library, enable in all test
> programs.
> > - test harness does "qpidd --daemon --port 0 --print-port" and sets the
> printed port to QPID_PORT in env for all test clients.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by "John O'Hara (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501563 ] 

John O'Hara commented on QPID-504:
----------------------------------

I've not run the C qpidd (shame on me); is it in the tradition of a 100% silent daemon, or does it print startup messages?

If the latter, it could always print out the port number in the same place everytime....along with other pertinent info like version numbers and whether or not the server is running with default security.

Both the C and Java brokers should behave in the same way and accept the same command line options (where that makes sense).

Thoughts?
John

> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by "Nuno Santos (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504008 ] 

Nuno Santos commented on QPID-504:
----------------------------------

To clarify my comment above, having the option to output the bound port upon request (ie, having the command line option --print-port) is not enough for the purposes of testing because it does not address the possibility of having more than one broker running at the same time. Say within the context of a test suite / automated build, you start a broker instance, and then call --print-port... if there was already another broker running, which one will respond? 

I think we need to provide a mechanism similar to what John was referring to above, where the broker prints the bound port upon start-up (which can then be grabbed by whoever starts a specific instance of the broker). This can be in addition to --print-port.


> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>            Assignee: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (QPID-504) Dynamic port for automated tests.

Posted by "Alan Conway (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Conway reassigned QPID-504:
--------------------------------

    Assignee: Alan Conway

> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>            Assignee: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by "Nuno Santos (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503456 ] 

Nuno Santos commented on QPID-504:
----------------------------------

There's something else beyond interoperability at the command-line level, it's the possibility of tests/clients in onle language to interoperate with a broker in a different language. For that to be possible -- and it's an important feature from an automated testing perspective -- the tests/clients need to somehow be able to figure out what port they should be connecting to. Having the option of the broker printing out its bound port upon invocation on the command line solves that, except when there are multiple brokers running (such as in a test environment).


> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>            Assignee: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by "Alan Conway (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504234 ] 

Alan Conway commented on QPID-504:
----------------------------------

The C++ broker now works as follows: qpidd --daemon --port 0 binds to an available port (selected by the OS) and prints the bound port. There's no explicit --print-port, if the requested port is 0 the actual bound port is always printed. This solves both problems mentioned above.
 
This JIRA remains open because the C++ tests need to be reworked to accept the broker port in a consistent way. I suggest they use the same option parser used by qpidd, so that they can accept either a --port option or a QPID_PORT environment variable. The latter makes things particularly easy for test scripts:
export QPID_PORT=`qpidd -dp0`
run_clients # No extra flags needed if clients use QPID_PORT env var.


> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>            Assignee: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (QPID-504) Dynamic port for automated tests.

Posted by "Alan Conway (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502548 ] 

Alan Conway commented on QPID-504:
----------------------------------

qpidd prints log messages to a configurable destination: stderr, file or syslog. However --print-port or suchlike options are exceptions and print to stdout. It's only likely to be used for development/debugging so it's not a problem.

> Both the C and Java brokers should behave in the same way and accept the same command line options (where that makes sense). 
A fine aspiration, but it won't happen without significant effort on both sides. The easiest way to do things in each language is very different. qpidd uses boost::program_options for command line and config file parsing. It is farily flexbile if we ever do sit down and agree on this stuff.


> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (QPID-504) Dynamic port for automated tests.

Posted by "Alan Conway (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Conway resolved QPID-504.
------------------------------

    Resolution: Fixed

        Make check now starts a broker on a dynamically assigned port, so
        multiple qpid builds on one host will not conflict.

        * src/tests/run_test, start_broker, kill_broker:
          Broker writes port to file, run_test sets QPID_PORT
          in environment of all tests.

        * src/tests/topic_publisher.cpp, topic_listener.cpp, client_test.cpp:
          All test clients use TestOptions to parse options from args and env.

        * src/qpid/Options.h: Renamed from CommonOptions.h
          Simplified use of Options class.

        * src/qpid/Url.h: Renamed defaultPort constant.

        * src/tests/logging.cpp:
        * src/tests/interop_runner.cpp:
        * src/tests/TestOptions.h:
        * src/qpidd.cpp:
        * src/qpid/log/Options.cpp:
        * src/qpid/log/Logger.cpp:
        * src/qpid/broker/Broker.cpp:
          Updated for changes to Options.


> Dynamic port for automated tests.
> ---------------------------------
>
>                 Key: QPID-504
>                 URL: https://issues.apache.org/jira/browse/QPID-504
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Broker
>            Reporter: Alan Conway
>            Assignee: Alan Conway
>
> As development ramps up we will have multiple qpid builds on the same machine clashing for use of the AMQP default port.
> All automated tests should use a *dynamically assigned* (i.e. bind(0)) port. 
> Allowing a manually specified port number for tests doesn't solve the problem as there's no way to choose
> a port that is guaranteed not to be used by any other test on the same host.
> One way to do this:
> - add qpidd --print-port option to print the actual bound port
> - add qpid option processing to qpid client library, enable in all test programs. 
> - test harness does "qpidd --daemon --port 0 --print-port" and sets the printed port to QPID_PORT in env for all test clients.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.