From 8034affaba71c0d991bfe1fff5de537f73d0f404 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 15 Jun 2011 20:08:15 +0000 Subject: NO-JIRA: Fix sporadic failures in cluster_tests.py test_management. Fix timing problems with broker shut down in this test. Kill all brokers in the test, rather than leaving the last 2 running to be cleaned up by the harness. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1136166 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/brokertest.py | 2 +- cpp/src/tests/cluster_tests.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'cpp') diff --git a/cpp/src/tests/brokertest.py b/cpp/src/tests/brokertest.py index 249cc126cb..36c91489e2 100644 --- a/cpp/src/tests/brokertest.py +++ b/cpp/src/tests/brokertest.py @@ -76,7 +76,7 @@ def error_line(filename, n=1): except: return "" return ":\n" + "".join(result) -def retry(function, timeout=10, delay=.01): +def retry(function, timeout=30, delay=.01): """Call function until it returns True or timeout expires. Double the delay for each retry. Return True if function returns true, False if timeout expires.""" diff --git a/cpp/src/tests/cluster_tests.py b/cpp/src/tests/cluster_tests.py index e1ab77bca6..66cfd27f7b 100755 --- a/cpp/src/tests/cluster_tests.py +++ b/cpp/src/tests/cluster_tests.py @@ -787,7 +787,7 @@ class LongTests(BrokerTest): args += ["--log-enable=trace+:management"] # Use store if present. if BrokerTest.store_lib: args +=["--load-module", BrokerTest.store_lib] - cluster = self.cluster(3, args) + cluster = self.cluster(3, args, expect=EXPECT_EXIT_FAIL) # brokers will be killed clients = [] # Per-broker list of clients that only connect to one broker. mclients = [] # Management clients that connect to every broker in the cluster. @@ -822,7 +822,7 @@ class LongTests(BrokerTest): for b in cluster[alive:]: b.ready() # Check if a broker crashed. # Kill the first broker, expect the clients to fail. b = cluster[alive] - b.expect = EXPECT_EXIT_FAIL + b.ready() b.kill() # Stop the brokers clients and all the mclients. for c in clients[alive] + mclients: @@ -832,11 +832,15 @@ class LongTests(BrokerTest): mclients = [] # Start another broker and clients alive += 1 - cluster.start() + cluster.start(expect=EXPECT_EXIT_FAIL) + cluster[-1].ready() # Wait till its ready start_clients(cluster[-1]) start_mclients(cluster[alive]) for c in chain(mclients, *clients): c.stop() + for b in cluster[alive:]: + b.ready() # Verify still alive + b.kill() # Verify that logs are consistent cluster_test_logs.verify_logs() -- cgit v1.2.1