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 | f6c381009bf361da1aac318981e24293c8ea688c (patch) | |
| tree | 84aca6ed8ecc97cbb0e806508f9d871bc3e35f52 /java | |
| parent | 1f641d41a35735dc9c5af5d514e3e8d5891168b7 (diff) | |
| download | qpid-python-f6c381009bf361da1aac318981e24293c8ea688c.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/qpid@1147076 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java index 35650e314a..11db513e00 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java +++ b/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); + } } } |
