qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1147076 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
Date Fri, 15 Jul 2011 10:26:24 GMT
Author: robbie
Date: Fri Jul 15 10:26:24 2011
New Revision: 1147076

URL: http://svn.apache.org/viewvc?rev=1147076&view=rev
Log:
QPID-3359: revert testNoFailover to run in same-vm profiles only

Applied patch by Keith Wall <keith.wall@gmail.com>

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java?rev=1147076&r1=1147075&r2=1147076&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java
Fri Jul 15 10:26:24 2011
@@ -159,19 +159,34 @@ public class FailoverMethodTest extends 
      */
     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 
             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 
 
             //Ensure we collect the brokerStart thread
             brokerStart.join();
+            brokerStart = null;
 
             start = System.currentTimeMillis();
 
@@ -233,6 +248,23 @@ public class FailoverMethodTest extends 
         {
             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);
+        }
     }
 
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message