From b4462bef74f9dfedf726f4eed29f9463825e2d7b Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 18 Jan 2011 20:43:41 +0000 Subject: QPID-2982 Bug 669452 - Creating a route and using management tools can crash cluster members. Cluster update did not include federation link and bridge objects. Fixed update to include them. Management linkUp and linkDown events were generated only on the broker receiving the link. Suppressed these events in a cluster. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1060568 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/cluster_test_logs.py | 3 ++- qpid/cpp/src/tests/cluster_tests.py | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/tests') diff --git a/qpid/cpp/src/tests/cluster_test_logs.py b/qpid/cpp/src/tests/cluster_test_logs.py index 261b1d522b..eae28fc4e5 100755 --- a/qpid/cpp/src/tests/cluster_test_logs.py +++ b/qpid/cpp/src/tests/cluster_test_logs.py @@ -58,7 +58,8 @@ def filter_log(log): 'warning Broker closed connection: 200, OK', 'task late', 'task overran', - 'warning CLOSING .* unsent data' + 'warning CLOSING .* unsent data', + 'Inter-broker link ' ]) if re.compile(skip).search(l): continue diff --git a/qpid/cpp/src/tests/cluster_tests.py b/qpid/cpp/src/tests/cluster_tests.py index 8bc89b2292..9bfd1b2d89 100755 --- a/qpid/cpp/src/tests/cluster_tests.py +++ b/qpid/cpp/src/tests/cluster_tests.py @@ -26,6 +26,7 @@ from qpid.messaging import Message, Empty from threading import Thread, Lock from logging import getLogger from itertools import chain +from tempfile import NamedTemporaryFile log = getLogger("qpid.cluster_tests") @@ -264,6 +265,45 @@ acl allow all all cluster.start() self.assertRaises(Empty, cluster[1].connect().session().receiver("q1").fetch,0) + def test_route_update(self): + """Regression test for https://issues.apache.org/jira/browse/QPID-2982 + Links and bridges associated with routes were not replicated on update. + This meant extra management objects and caused an exit if a management + client was attached. + """ + args=["--mgmt-pub-interval=1","--log-enable=trace+:management"] + cluster0 = self.cluster(1, args=args) + cluster1 = self.cluster(1, args=args) + assert 0 == subprocess.call( + ["qpid-route", "route", "add", cluster0[0].host_port(), + cluster1[0].host_port(), "dummy-exchange", "dummy-key", "-d"]) + cluster0.start() + + # Wait for qpid-tool:list on cluster0[0] to generate expected output. + pattern = re.compile("org.apache.qpid.broker.*link") + qpid_tool = subprocess.Popen(["qpid-tool", cluster0[0].host_port()], + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + class Scanner(Thread): + def __init__(self): self.found = False; Thread.__init__(self) + def run(self): + for l in qpid_tool.stdout: + if pattern.search(l): self.found = True; return + scanner = Scanner() + scanner.start() + start = time.time() + try: + # Wait up to 5 second timeout for scanner to find expected output + while not scanner.found and time.time() < start + 5: + qpid_tool.stdin.write("list\n") # Ask qpid-tool to list + for b in cluster0: b.ready() # Raise if any brokers are down + finally: + qpid_tool.stdin.write("quit\n") + qpid_tool.wait() + scanner.join() + assert scanner.found + # Verify logs are consistent + cluster_test_logs.verify_logs(glob.glob("*.log")) + class LongTests(BrokerTest): """Tests that can run for a long time if -DDURATION= is set""" def duration(self): -- cgit v1.2.1