diff options
author | Robert Gemmell <robbie@apache.org> | 2011-07-15 10:26:24 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2011-07-15 10:26:24 +0000 |
commit | ab26301e6a49d241f5e816284c49bc5e795eb245 (patch) | |
tree | 4c6f06ec01c7d8833ab97ecc74b192aa04ab861a | |
parent | 7962623cf4fbdb2f5a1d71b615814f922a7f2409 (diff) | |
download | qpid-python-ab26301e6a49d241f5e816284c49bc5e795eb245.tar.gz |
QPID-3359: revert testNoFailover to run in same-vm profiles only
Applied patch by Keith Wall <keith.wall@gmail.com>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1147076 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java index 35650e314a..11db513e00 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java @@ -159,19 +159,34 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL */ public void testNoFailover() throws Exception { + if (!isInternalBroker()) + { + // QPID-3359 + // These tests always used to be inVM tests, then QPID-2815, with removal of ivVM, + // converted the test to use QpidBrokerTestCase. However, since then we notice this + // test fails on slower CI boxes. It turns out the test design is *extremely* + // sensitive the length of time the broker takes to start up. + // + // Making the test a same-VM test to temporarily avoid the issue. In long term, test + // needs redesigned to avoid the issue. + return; + } + int CONNECT_DELAY = 2000; String connectionString = "amqp://guest:guest@/test?brokerlist='tcp://localhost:" + getPort() + "?connectdelay='" + CONNECT_DELAY + "'," + "retries='3'',failover='nofailover'"; + AMQConnectionURL url = new AMQConnectionURL(connectionString); + Thread brokerStart = null; try { //Kill initial broker stopBroker(); //Create a thread to start the broker asynchronously - Thread brokerStart = new Thread(new Runnable() + brokerStart = new Thread(new Runnable() { public void run() { @@ -194,7 +209,6 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL brokerStart.start(); long start = System.currentTimeMillis(); - //Start the connection so it will use the retries AMQConnection connection = new AMQConnection(url, null); @@ -210,6 +224,7 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL //Ensure we collect the brokerStart thread brokerStart.join(); + brokerStart = null; start = System.currentTimeMillis(); @@ -233,6 +248,23 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL { fail(e.getMessage()); } + finally + { + // Guard against the case where the broker took too long to start + // and the initial connection failed to be formed. + if (brokerStart != null) + { + brokerStart.join(); + } + } + } + + public void stopBroker(int port) throws Exception + { + if (isBrokerPresent(port)) + { + super.stopBroker(port); + } } } |