summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/ha_tests.py
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-10-09 19:52:24 +0000
committerAlan Conway <aconway@apache.org>2012-10-09 19:52:24 +0000
commiteef14cb62023b3f47cd2d4fc23a9d46720ddefd3 (patch)
tree608b353c62891fa277d3cd9ef39d6ed599b9b905 /qpid/cpp/src/tests/ha_tests.py
parent58bc28edb31673198e04b59472ee7e2ad40e24f0 (diff)
downloadqpid-python-eef14cb62023b3f47cd2d4fc23a9d46720ddefd3.tar.gz
QPID-4360: Fix test bug: Non-ready HA broker can be incorrectly promoted to primary.
Test test_delete_missing_response was failing with "cluster active, cannot promote". - Fixed test bug: "fake" primary triggered "cannot promote". - Backup: always create QueueReplicator if not already existing. - Terminology change: "initial" queues -> "catch-up" queues. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1396244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/ha_tests.py')
-rwxr-xr-xqpid/cpp/src/tests/ha_tests.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/qpid/cpp/src/tests/ha_tests.py b/qpid/cpp/src/tests/ha_tests.py
index a8d16a77c9..7ce0d1701a 100755
--- a/qpid/cpp/src/tests/ha_tests.py
+++ b/qpid/cpp/src/tests/ha_tests.py
@@ -627,25 +627,29 @@ acl deny all all
def test_delete_missing_response(self):
"""Check that a backup correctly deletes leftover queues and exchanges that are
missing from the initial reponse set."""
- cluster = HaCluster(self,2)
- s = cluster[0].connect().session()
+ # This test is a bit contrived, we set up the situation on backup brokers
+ # and then promote one.
+ cluster = HaCluster(self, 2, promote=False)
+
+ # cluster[0] Will be the primary
+ s = cluster[0].connect_admin().session()
s.sender("q1;{create:always}")
- s.sender("q2;{create:always}")
s.sender("e1;{create:always, node:{type:topic}}")
- s.sender("e2;{create:always, node:{type:topic}}")
- cluster.bounce(0, promote_next=False)
- # Fake a primary that has deleted some queues and exchanges.
- s = cluster[0].connect_admin().session()
+
+ # cluster[1] will be the backup, has extra queues/exchanges
+ s = cluster[1].connect_admin().session()
+ s.sender("q1;{create:always}")
s.sender("q2;{create:always}")
+ s.sender("e1;{create:always, node:{type:topic}}")
s.sender("e2;{create:always, node:{type:topic}}")
- s.sender("x;{create:always}") # A new queue so we can wait for the update.
+ for a in ["q1", "q2", "e1", "e2"]: cluster[1].wait_backup(a)
+
cluster[0].promote()
- # Verify the backup has deleted the missing queues and exchanges
+ # Verify the backup deletes the surpluis queue and exchange
cluster[1].wait_status("ready")
s = cluster[1].connect_admin().session()
- cluster[1].wait_backup("x");
- self.assertRaises(NotFound, s.receiver, ("q1"));
- self.assertRaises(NotFound, s.receiver, ("e1"));
+ self.assertRaises(NotFound, s.receiver, ("q2"));
+ self.assertRaises(NotFound, s.receiver, ("e2"));
def test_auto_delete_qpid_4285(self):