You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Robert Godfrey <ro...@gmail.com> on 2007/01/17 13:14:59 UTC

Python Test: test.queue.QueueTests.test_purge and Connection Closing

All,

I've been working on the Java broker to get it compliant with the python
tests.  On my working copy I have it working with all tests except those
that require wildcard Topic matching (which I believe Martin will be
implementing shortly).  However, there is one test where I am unsure whether
there is a bug in the test, or whether my understanding of Python/AMQP is
faulty:

in test.queue.QueueTests.test_purge we have the following code:


        try:
            #queue not specified and none previously declared for channel:
            channel.queue_purge()
            self.fail("Expected failure when purging unspecified queue")
        except Closed, e:
            self.assertConnectionException(530, e.args[0])

        #cleanup
        channel = self.client.channel(4)
        channel.channel_open()

That it is asserts that there is a connection exception, of error code 530 -
but (I believe) it then attempts to open a channel on the same connection.
This test was failing for me (after I implemented Queue.purge) because the
channel_open fails.

I could make the test pass by having the broker return a connection
exception and not close the connection... but my understanding was that if
you get a connection exception, then the connection will be closed.

Am I correct in my understanding, and is the python test therefore broken?



Thanks,

Rob

Re: Python Test: test.queue.QueueTests.test_purge and Connection Closing

Posted by Gordon Sim <gs...@redhat.com>.
Alan Conway wrote:
> On Thu, 2007-01-18 at 08:35 +0000, Gordon Sim wrote:
>> Gordon Sim wrote:
>>> Robert Godfrey wrote:
>>>> OK - I'll add a fix to the Python test to my patch then... I guess 
>>>> that may
>>>> mean there is a bug in the C++ broker if it passes this test :-)
>>> Yes, I'll have a look into that.
>>>
>> FYI: I have checked in a fix to the python test (and to the c++ broker 
>> which was indeed failing to close the connection). I also came upon a 
>> race in the processing of the socket close and the connection.close 
>> method and have put in a tentative workaround for that.
> 
> Fixed on trunk? Is this a fix that I'll need to merge to 0-9 to make all
> python tests pas there? 

Yes, its a fix on trunk (both c++ and python). We will want to merge it 
on to 0-9, but my changes shouldn't break anything on the 0-9 branch.

Re: Python Test: test.queue.QueueTests.test_purge and Connection Closing

Posted by Alan Conway <ac...@redhat.com>.
On Thu, 2007-01-18 at 08:35 +0000, Gordon Sim wrote:
> Gordon Sim wrote:
> > Robert Godfrey wrote:
> >> OK - I'll add a fix to the Python test to my patch then... I guess 
> >> that may
> >> mean there is a bug in the C++ broker if it passes this test :-)
> > 
> > Yes, I'll have a look into that.
> > 
> 
> FYI: I have checked in a fix to the python test (and to the c++ broker 
> which was indeed failing to close the connection). I also came upon a 
> race in the processing of the socket close and the connection.close 
> method and have put in a tentative workaround for that.

Fixed on trunk? Is this a fix that I'll need to merge to 0-9 to make all
python tests pas there? 

Cheers,
Alan.


Re: Python Test: test.queue.QueueTests.test_purge and Connection Closing

Posted by Gordon Sim <gs...@redhat.com>.
Gordon Sim wrote:
> Robert Godfrey wrote:
>> OK - I'll add a fix to the Python test to my patch then... I guess 
>> that may
>> mean there is a bug in the C++ broker if it passes this test :-)
> 
> Yes, I'll have a look into that.
> 

FYI: I have checked in a fix to the python test (and to the c++ broker 
which was indeed failing to close the connection). I also came upon a 
race in the processing of the socket close and the connection.close 
method and have put in a tentative workaround for that.

Re: Python Test: test.queue.QueueTests.test_purge and Connection Closing

Posted by Gordon Sim <gs...@redhat.com>.
Robert Godfrey wrote:
> OK - I'll add a fix to the Python test to my patch then... I guess that may
> mean there is a bug in the C++ broker if it passes this test :-)

Yes, I'll have a look into that.

Re: Python Test: test.queue.QueueTests.test_purge and Connection Closing

Posted by Robert Godfrey <ro...@gmail.com>.
OK - I'll add a fix to the Python test to my patch then... I guess that may
mean there is a bug in the C++ broker if it passes this test :-)

- Rob

Re: Python Test: test.queue.QueueTests.test_purge and Connection Closing

Posted by Gordon Sim <gs...@redhat.com>.
Robert Godfrey wrote:
> All,
> 
> I've been working on the Java broker to get it compliant with the python
> tests.  On my working copy I have it working with all tests except those
> that require wildcard Topic matching (which I believe Martin will be
> implementing shortly).  However, there is one test where I am unsure 
> whether
> there is a bug in the test, or whether my understanding of Python/AMQP is
> faulty:
> 
> in test.queue.QueueTests.test_purge we have the following code:
> 
> 
>        try:
>            #queue not specified and none previously declared for channel:
>            channel.queue_purge()
>            self.fail("Expected failure when purging unspecified queue")
>        except Closed, e:
>            self.assertConnectionException(530, e.args[0])
> 
>        #cleanup
>        channel = self.client.channel(4)
>        channel.channel_open()
> 
> That it is asserts that there is a connection exception, of error code 
> 530 -
> but (I believe) it then attempts to open a channel on the same connection.
> This test was failing for me (after I implemented Queue.purge) because the
> channel_open fails.
> 
> I could make the test pass by having the broker return a connection
> exception and not close the connection... but my understanding was that if
> you get a connection exception, then the connection will be closed.
> 
> Am I correct in my understanding, and is the python test therefore broken?
> 

It certainly looks that way to me. A new connection should be 
established for the cleanup.