From 6fc4eec9fcf8d659b055d994119a1871d09c1d90 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 18 Jan 2007 08:14:36 +0000 Subject: Modified handling of reason for closing in peer to work around race between worker and reader where a connection.close is followed by the socket closing (this is a bit of a hack). Modified test for queue_purge to do cleanup on new connection. Separated testing of scenario where closed channel is used from that where an unopened channel is used. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@497342 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/python/java_failing.txt | 1 + qpid/python/qpid/peer.py | 2 ++ qpid/python/tests/broker.py | 4 ++-- qpid/python/tests/queue.py | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) (limited to 'qpid/python') diff --git a/qpid/python/java_failing.txt b/qpid/python/java_failing.txt index a564fe0148..b6cfdc600e 100644 --- a/qpid/python/java_failing.txt +++ b/qpid/python/java_failing.txt @@ -13,3 +13,4 @@ tests.queue.QueueTests.test_declare_exclusive tests.queue.QueueTests.test_purge tests.testlib.TestBaseTest.testMessageProperties tests.broker.BrokerTests.test_invalid_channel +tests.broker.BrokerTests.test_closed_channel diff --git a/qpid/python/qpid/peer.py b/qpid/python/qpid/peer.py index acffeb2537..a265e45f43 100644 --- a/qpid/python/qpid/peer.py +++ b/qpid/python/qpid/peer.py @@ -129,6 +129,8 @@ class Channel: self.reason = None def close(self, reason): + if isinstance(reason, Message): + self.reason = reason if self.closed: return self.closed = True diff --git a/qpid/python/tests/broker.py b/qpid/python/tests/broker.py index f3888589a5..d9ac69c5e3 100644 --- a/qpid/python/tests/broker.py +++ b/qpid/python/tests/broker.py @@ -85,14 +85,14 @@ class BrokerTests(TestBase): self.assert_(msg.content.body == body) def test_invalid_channel(self): - other = self.connect() - channel = other.channel(200) + channel = self.client.channel(200) try: channel.queue_declare(exclusive=True) self.fail("Expected error on queue_declare for invalid channel") except Closed, e: self.assertConnectionException(504, e.args[0]) + def test_closed_channel(self): channel = self.client.channel(200) channel.channel_open() channel.channel_close() diff --git a/qpid/python/tests/queue.py b/qpid/python/tests/queue.py index d5c13fa87a..9e32c44fd5 100644 --- a/qpid/python/tests/queue.py +++ b/qpid/python/tests/queue.py @@ -74,7 +74,8 @@ class QueueTests(TestBase): self.assertConnectionException(530, e.args[0]) #cleanup - channel = self.client.channel(4) + other = self.connect() + channel = other.channel(1) channel.channel_open() channel.exchange_delete(exchange="test-exchange") -- cgit v1.2.1