diff options
author | Gordon Sim <gsim@apache.org> | 2006-11-17 11:03:22 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2006-11-17 11:03:22 +0000 |
commit | bf74286e6a5eba055fd8bf9410c325205b8595d5 (patch) | |
tree | 46fafd1086d95b543e5b8c4927ba28daa50e7da9 /python/tests | |
parent | d965a29414762f0b3bbc840485f6327c3d523946 (diff) | |
download | qpid-python-bf74286e6a5eba055fd8bf9410c325205b8595d5.tar.gz |
Some fixes and tests for bugs uncovered during testing of persistence.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@476108 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/tx.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/python/tests/tx.py b/python/tests/tx.py index e8d0e99628..054fb8d8b7 100644 --- a/python/tests/tx.py +++ b/python/tests/tx.py @@ -55,6 +55,42 @@ class TxTests(TestBase): channel.basic_ack(delivery_tag=0, multiple=True) channel.tx_commit() + def test_auto_rollback(self): + """ + Test that a channel closed with an open transaction is effectively rolled back + """ + channel = self.channel + queue_a, queue_b, queue_c = self.perform_txn_work(channel, "tx-autorollback-a", "tx-autorollback-b", "tx-autorollback-c") + + for q in [queue_a, queue_b, queue_c]: + try: + extra = q.get(timeout=1) + self.fail("Got unexpected message: " + extra.content.body) + except Empty: None + + channel.tx_rollback() + + #check results + for i in range(1, 5): + msg = queue_a.get(timeout=1) + self.assertEqual("Message %d" % i, msg.content.body) + + msg = queue_b.get(timeout=1) + self.assertEqual("Message 6", msg.content.body) + + msg = queue_c.get(timeout=1) + self.assertEqual("Message 7", msg.content.body) + + for q in [queue_a, queue_b, queue_c]: + try: + extra = q.get(timeout=1) + self.fail("Got unexpected message: " + extra.content.body) + except Empty: None + + #cleanup + channel.basic_ack(delivery_tag=0, multiple=True) + channel.tx_commit() + def test_rollback(self): """ Test that rolled back publishes are not delivered and rolled back acks are re-delivered @@ -90,7 +126,7 @@ class TxTests(TestBase): #cleanup channel.basic_ack(delivery_tag=0, multiple=True) channel.tx_commit() - + def perform_txn_work(self, channel, name_a, name_b, name_c): """ Utility method that does some setup and some work under a transaction. Used for testing both |