Return-Path: Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: (qmail 38158 invoked from network); 2 Feb 2011 19:59:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2011 19:59:03 -0000 Received: (qmail 58529 invoked by uid 500); 2 Feb 2011 19:59:03 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 58473 invoked by uid 500); 2 Feb 2011 19:59:02 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 58466 invoked by uid 99); 2 Feb 2011 19:59:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 19:59:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Feb 2011 19:59:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 45BA223889CB; Wed, 2 Feb 2011 19:58:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1066599 - /qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Date: Wed, 02 Feb 2011 19:58:39 -0000 To: commits@qpid.apache.org From: aconway@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110202195839.45BA223889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: aconway Date: Wed Feb 2 19:58:38 2011 New Revision: 1066599 URL: http://svn.apache.org/viewvc?rev=1066599&view=rev Log: Do one long run in cluster_tests.py test_management. Instead of all short runs, use duration/4 for the first runs, then use 5 secs for remaining runs to get plenty of broker kills. Modified: qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Modified: qpid/trunk/qpid/cpp/src/tests/cluster_tests.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/cluster_tests.py?rev=1066599&r1=1066598&r2=1066599&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/cluster_tests.py (original) +++ qpid/trunk/qpid/cpp/src/tests/cluster_tests.py Wed Feb 2 19:58:38 2011 @@ -7,9 +7,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -290,7 +290,7 @@ acl allow all all if pattern.search(l): self.found = True; return scanner = Scanner() scanner.start() - start = time.time() + 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: @@ -402,7 +402,7 @@ class LongTests(BrokerTest): # Use store if present. if BrokerTest.store_lib: args +=["--load-module", BrokerTest.store_lib] cluster = self.cluster(3, args) - + clients = [] # Per-broker list of clients that only connect to one broker. mclients = [] # Management clients that connect to every broker in the cluster. @@ -422,18 +422,20 @@ class LongTests(BrokerTest): mclients.append(ClientLoop(broker, cmd)) endtime = time.time() + self.duration() + runtime = self.duration() / 4 # First run is longer, use quarter of duration. alive = 0 # First live cluster member for i in range(len(cluster)): start_clients(cluster[i]) start_mclients(cluster[alive]) while time.time() < endtime: - time.sleep(5) + time.sleep(runtime) + runtime = 5 # Remaining runs 5 seconds, frequent broker kills for b in cluster[alive:]: b.ready() # Check if a broker crashed. - # Kill the first broker, expect the clients to fail. + # Kill the first broker, expect the clients to fail. b = cluster[alive] b.expect = EXPECT_EXIT_FAIL b.kill() - # Stop the brokers clients and all the mclients. + # Stop the brokers clients and all the mclients. for c in clients[alive] + mclients: try: c.stop() except: pass # Ignore expected errors due to broker shutdown. @@ -460,14 +462,14 @@ class LongTests(BrokerTest): while (time.time() < end): # Get a management interval for i in xrange(1000): cluster[0].connect().close() cluster_test_logs.verify_logs() - + class StoreTests(BrokerTest): """ Cluster tests that can only be run if there is a store available. """ def args(self): - assert BrokerTest.store_lib + assert BrokerTest.store_lib return ["--load-module", BrokerTest.store_lib] def test_store_loaded(self): @@ -532,7 +534,7 @@ class StoreTests(BrokerTest): b = cluster.start("b", wait=False) c = cluster.start("c", wait=True) self.assertEqual(a.get_message("q").content, "clean") - + def test_wrong_cluster_id(self): # Start a cluster1 broker, then try to restart in cluster2 cluster1 = self.cluster(0, args=self.args()) @@ -591,16 +593,16 @@ class StoreTests(BrokerTest): c = cluster.start("c", expect=EXPECT_EXIT_FAIL) self.assertEqual(b.store_state(), "dirty") self.assertEqual(c.store_state(), "dirty") - retry(lambda: a.store_state() == "dirty") + retry(lambda: a.store_state() == "dirty") a.send_message("q", Message("x", durable=True)) a.kill() b.kill() # c is last man, will mark store clean - retry(lambda: c.store_state() == "clean") + retry(lambda: c.store_state() == "clean") a = cluster.start("a", expect=EXPECT_EXIT_FAIL) # c no longer last man - retry(lambda: c.store_state() == "dirty") + retry(lambda: c.store_state() == "dirty") c.kill() # a is now last man - retry(lambda: a.store_state() == "clean") + retry(lambda: a.store_state() == "clean") a.kill() self.assertEqual(a.store_state(), "clean") self.assertEqual(b.store_state(), "dirty") --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org