summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-04-29 15:57:59 +0000
committerAlan Conway <aconway@apache.org>2013-04-29 15:57:59 +0000
commit1d9f1a0bb5892c4ce289355f276682029a3d6ca0 (patch)
tree2124944807ddfde7baf7cfc96e92e4033e432a24 /cpp/src/tests
parent793a8dd85e7e4fc5f833b73d1713b18e70ebede8 (diff)
downloadqpid-python-1d9f1a0bb5892c4ce289355f276682029a3d6ca0.tar.gz
QPID-4787: HA brokers find self-address in brokers_url.
HA brokers need to know their own addresses, but it is not safe to simply use local hosts name and Broker::getPort() since the broker may be listening on multiple addresses. The solution is to have brokers check the ha-rokers-url for their own address while doing the initial status check of the cluster. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1477165 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rwxr-xr-xcpp/src/tests/ha_tests.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/cpp/src/tests/ha_tests.py b/cpp/src/tests/ha_tests.py
index e7be2a246d..8ee27b5519 100755
--- a/cpp/src/tests/ha_tests.py
+++ b/cpp/src/tests/ha_tests.py
@@ -545,26 +545,25 @@ class ReplicationTests(HaBrokerTest):
"""Check that broker information is correctly published via management"""
cluster = HaCluster(self, 3)
+ def ha_broker(broker):
+ ha_broker = broker.agent().getHaBroker();
+ ha_broker.update()
+ return ha_broker
+
for broker in cluster: # Make sure HA system-id matches broker's
- qmf = broker.agent().getHaBroker()
- self.assertEqual(qmf.systemId, UUID(broker.agent().getBroker().systemRef))
-
- cluster_ports = map(lambda b: b.port(), cluster)
- cluster_ports.sort()
- def ports(qmf):
- qmf.update()
- return sorted(map(lambda b: b["port"], qmf.members))
+ self.assertEqual(ha_broker(broker).systemId, UUID(broker.agent().getBroker().systemRef))
+
# Check that all brokers have the same membership as the cluster
- for broker in cluster:
- qmf = broker.agent().getHaBroker()
- assert retry(lambda: cluster_ports == ports(qmf), 1), "%s != %s on %s"%(cluster_ports, ports(qmf), broker)
+ def check_ids(broker):
+ cluster_ids = set([ ha_broker(b).systemId for b in cluster])
+ broker_ids = set([m["system-id"] for m in ha_broker(broker).members])
+ assert retry(lambda: cluster_ids == broker_ids, 1), "%s != %s on %s"%(cluster_ids, broker_ids, broker)
+
+ for broker in cluster: check_ids(broker)
+
# Add a new broker, check it is updated everywhere
b = cluster.start()
- cluster_ports.append(b.port())
- cluster_ports.sort()
- for broker in cluster:
- qmf = broker.agent().getHaBroker()
- assert retry(lambda: cluster_ports == ports(qmf), 1), "%s != %s"%(cluster_ports, ports(qmf))
+ for broker in cluster: check_ids(broker)
def test_auth(self):
"""Verify that authentication does not interfere with replication."""