Bug 795777

Summary: qpid-python-test should by default pass not just broker host but also broker port
Product: Red Hat Enterprise MRG Reporter: Frantisek Reznicek <freznice>
Component: python-qpidAssignee: Darryl L. Pierce <dpierce>
Status: CLOSED NOTABUG QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: DevelopmentCC: esammons, iboverma, jross, lzhaldyb, pematous, tross
Target Milestone: 2.3Keywords: Improvement
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-06 14:47:06 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Frantisek Reznicek 2012-02-21 09:12:32 EST
Description of problem:

qpid-python-test should be updated to pass by defult not just broker host but also broker port.

Some tests were found failing (for instance bug 693978) when test suite ran w/o --broker <host>:<port> switch.

I propose to change --broker parameter default from 'localhost' to 'localhost:5672', see attached patch.

Version-Release number of selected component (if applicable):
python-qpid-0.14-4.el5

How reproducible:
100%

Steps to Reproduce:
1. qpid-python-test -m qpid_tests 'qpid_tests.*'
2. find qpid_tests.broker_0_10.management.ManagementTest.test_immediate_method test error
  

Actual results:
Some tests failing due to self.broker.port being None.

Expected results:
self.broker.port should be by default 5672.

Additional info (Patch fixing the issue):

--- /usr/bin/qpid-python-test.orig   2012-01-18 11:25:02.000000000 +0100
+++ /usr/bin/qpid-python-test       2012-02-21 15:03:06.000000000 +0100
@@ -42,7 +42,7 @@
                                description="Run tests matching the specified PATTERNs.")
 parser.add_option("-l", "--list", action="store_true", default=False,
                   help="list tests instead of executing them")
-parser.add_option("-b", "--broker", default="localhost",
+parser.add_option("-b", "--broker", default="localhost:5672",
                   help="run tests against BROKER (default %default)")
 parser.add_option("-f", "--log-file", metavar="FILE", help="log output to FILE")
 parser.add_option("-v", "--log-level", metavar="LEVEL", default="WARN",
Comment 1 Darryl L. Pierce 2012-06-12 09:22:23 EDT
This patch is posted upstream in QPID-4058.

https://issues.apache.org/jira/secure/attachment/12531824/0001-Adds-the-port-to-the-default-broker-address-for-qpid.patch
Comment 4 Darryl L. Pierce 2012-11-02 16:26:52 EDT
In attempting to replicate this bug, I'm failing to get it to occur.

I have a RHEL 6.2 machine with the following packages installed:

mcpierce@mcp-rhel-62:~  $ rpm -q qpid-cpp-server python-qpid
qpid-cpp-server-0.14-22.el6_3.i686
python-qpid-0.14-11.el6_3.noarch

When I execute any of the following:

qpid-python-test
qpid-python-test --broker=localhost
qpid-python-test --broker=localhost:5672

the tests run as expected and pass.

When I execute any of the following:

qpid-python-test --broker=localhost:5762
qpid-python-test --broker=farkle

tests fail but for the expected reason.

I'm unable to replicate the original error since I'm apparently missing some tests since I see:

mcpierce@mcp-rhel-62:~  $ qpid-python-test -m qpid_tests 'qpid_tests.*'
Traceback (most recent call last):
  File "/usr/bin/qpid-python-test", line 522, in <module>
    m = __import__(name, None, None, ["dummy"])
ImportError: No module named qpid_tests

Can you please point me to where I can find the proper modules to replicate the test failure? Thanks.
Comment 5 Justin Ross 2012-11-05 13:13:20 EST
Frantisek, regarding Darryl's question above, does he need the rh-qpid package?
Comment 6 Justin Ross 2012-11-05 13:14:23 EST
Taking this back to ASSIGNED because the patch we have may not be final.
Comment 7 Frantisek Reznicek 2012-11-06 11:28:12 EST
(In reply to comment #4)
> In attempting to replicate this bug, I'm failing to get it to occur.
> 
> I have a RHEL 6.2 machine with the following packages installed:
> 
> mcpierce@mcp-rhel-62:~  $ rpm -q qpid-cpp-server python-qpid
> qpid-cpp-server-0.14-22.el6_3.i686
> python-qpid-0.14-11.el6_3.noarch
> 
> When I execute any of the following:
> 
> qpid-python-test
> qpid-python-test --broker=localhost
> qpid-python-test --broker=localhost:5672
> 
> the tests run as expected and pass.
> 
> When I execute any of the following:
> 
> qpid-python-test --broker=localhost:5762
> qpid-python-test --broker=farkle
> 
> tests fail but for the expected reason.
> 
> I'm unable to replicate the original error since I'm apparently missing some
> tests since I see:
> 
> mcpierce@mcp-rhel-62:~  $ qpid-python-test -m qpid_tests 'qpid_tests.*'
> Traceback (most recent call last):
>   File "/usr/bin/qpid-python-test", line 522, in <module>
>     m = __import__(name, None, None, ["dummy"])
> ImportError: No module named qpid_tests
> 
> Can you please point me to where I can find the proper modules to replicate
> the test failure? Thanks.

The package requirements for running those unit tests are:
- qpid-cpp-server*
- python-qpid (providing qpid-python-test)
- qpid-tests (providing qpid_tests dir missing in above message)
Comment 8 Darryl L. Pierce 2012-11-06 14:47:06 EST
I see four tests failing, but not due to the Qpid code base. Instead, they're failing due to the tests themselves have incorrect expectations.

Error during test:
  Traceback (most recent call last):
    File "/usr/bin/qpid-python-test", line 311, in run
      phase()
    File "/usr/lib/python2.6/site-packages/qpid_tests/broker_0_10/management.py", line 457, in test_immediate_method
      url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host, self.broker.port)
  TypeError: %d format: a number is required, not NoneType

The test is trying to parse out the URL and is requiring a port be provided. However, the Qpid code allows the port to be implied and not explicitly set.

    def test_immediate_method(self):
        url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host, self.broker.port)

The same thing is happening here but in a different spot in the test:

qpid_tests.broker_0_10.management.ManagementTest.test_timestamp_config ................................................................................. fail
Error during test:
  Traceback (most recent call last):
    File "/usr/bin/qpid-python-test", line 311, in run
      phase()
    File "/usr/lib/python2.6/site-packages/qpid_tests/broker_0_10/management.py", line 612, in test_timestamp_config
      url = "%s://%s:%d" % (self.broker.scheme or "amqp", self.broker.host, self.broker.port)
  TypeError: %d format: a number is required, not NoneType

Same here.

qpid_tests.broker_0_10.message.MessageTests.test_credit_flow_bytes ..................................................................................... fail
Error during test:
  Traceback (most recent call last):
    File "/usr/bin/qpid-python-test", line 311, in run
      phase()
    File "/usr/lib/python2.6/site-packages/qpid_tests/broker_0_10/message.py", line 454, in test_credit_flow_bytes
      self.assertDataEquals(session, q.get(timeout = 1), "abcdefgh")
    File "/usr/lib/python2.6/site-packages/qpid/queue.py", line 50, in get
      result = BaseQueue.get(self, block, timeout)
    File "/usr/lib/python2.6/Queue.py", line 176, in get
      raise Empty
  Empty

There is a different failure going on, though.

qpid_tests.broker_0_10.message.MessageTests.test_window_flow_bytes ..................................................................................... fail
Error during test:
  Traceback (most recent call last):
    File "/usr/bin/qpid-python-test", line 311, in run
      phase()
    File "/usr/lib/python2.6/site-packages/qpid_tests/broker_0_10/message.py", line 524, in test_window_flow_bytes
      msg = q.get(timeout = 1)
    File "/usr/lib/python2.6/site-packages/qpid/queue.py", line 50, in get
      result = BaseQueue.get(self, block, timeout)
    File "/usr/lib/python2.6/Queue.py", line 176, in get
      raise Empty
  Empty

Can we open a separate BZ for this if it can be shown to be an error in the Qpid code and not the test itself?