activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: AMQ-5923 - Increasing test timeout times
Date Wed, 16 Sep 2015 14:59:46 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 4cddd2c01 -> 8a09b7e5f


AMQ-5923 - Increasing test timeout times

Logging showed that intermittent test failures were caused by not
giving the tests enough time to finish. Also switched message
generation to create random sizes in order to improve testing.


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/8a09b7e5
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/8a09b7e5
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/8a09b7e5

Branch: refs/heads/master
Commit: 8a09b7e5f6cf5fcb5579f7183bd410f22be076a6
Parents: 4cddd2c
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Authored: Wed Sep 16 14:57:30 2015 +0000
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Wed Sep 16 14:57:30 2015 +0000

----------------------------------------------------------------------
 .../cursors/AbstractPendingMessageCursorTest.java    | 14 +++++++-------
 .../cursors/KahaDBPendingMessageCursorTest.java      |  4 ++--
 .../cursors/MemoryPendingMessageCursorTest.java      |  6 +++---
 .../store/AbstractMessageStoreSizeStatTest.java      |  8 ++++----
 .../activemq/store/AbstractStoreStatTestSupport.java | 15 ++++++++-------
 .../store/kahadb/KahaDBMessageStoreSizeStatTest.java |  2 +-
 .../kahadb/MultiKahaDBMessageStoreSizeStatTest.java  |  4 ++--
 .../store/memory/MemoryMessageStoreSizeStatTest.java |  4 ++--
 8 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursorTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursorTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursorTest.java
index 9b8ea91..798746b 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursorTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/AbstractPendingMessageCursorTest.java
@@ -179,7 +179,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
         verifyStoreStats(dest, 0, 0);
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testTopicMessageSize() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -205,7 +205,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
         connection.close();
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testTopicNonPersistentMessageSize() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -232,7 +232,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
         connection.close();
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testTopicPersistentAndNonPersistentMessageSize() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -261,7 +261,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
         connection.close();
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeOneDurable() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
@@ -286,7 +286,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
         connection.close();
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeOneDurablePartialConsumption() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -312,7 +312,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
         connection.close();
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeTwoDurables() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -518,7 +518,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
             MessageProducer prod = session.createProducer(topic);
             prod.setDeliveryMode(deliveryMode);
             for (int i = 0; i < publishSize; i++) {
-                prod.send(createMessage(session, AbstractPendingMessageCursorTest.maxMessageSize,
publishedMessageSize));
+                prod.send(createMessage(i, session, AbstractPendingMessageCursorTest.maxMessageSize,
publishedMessageSize));
             }
 
         } finally {

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/KahaDBPendingMessageCursorTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/KahaDBPendingMessageCursorTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/KahaDBPendingMessageCursorTest.java
index 557c70e..b0bca7d 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/KahaDBPendingMessageCursorTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/KahaDBPendingMessageCursorTest.java
@@ -68,7 +68,7 @@ public class KahaDBPendingMessageCursorTest extends
      *
      * @throws Exception
      */
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testDurableMessageSizeAfterRestartAndPublish() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -107,7 +107,7 @@ public class KahaDBPendingMessageCursorTest extends
      *
      * @throws Exception
      */
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testNonPersistentDurableMessageSize() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/MemoryPendingMessageCursorTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/MemoryPendingMessageCursorTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/MemoryPendingMessageCursorTest.java
index 948193d..16d1919 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/MemoryPendingMessageCursorTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/MemoryPendingMessageCursorTest.java
@@ -48,7 +48,7 @@ public class MemoryPendingMessageCursorTest extends AbstractPendingMessageCursor
 
 
     @Override
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeOneDurable() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
@@ -77,7 +77,7 @@ public class MemoryPendingMessageCursorTest extends AbstractPendingMessageCursor
     }
 
     @Override
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeTwoDurables() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -109,7 +109,7 @@ public class MemoryPendingMessageCursorTest extends AbstractPendingMessageCursor
     }
 
     @Override
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeOneDurablePartialConsumption() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractMessageStoreSizeStatTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractMessageStoreSizeStatTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractMessageStoreSizeStatTest.java
index 116500e..8f17746 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractMessageStoreSizeStatTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractMessageStoreSizeStatTest.java
@@ -92,7 +92,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
 
     protected abstract void initPersistence(BrokerService brokerService) throws IOException;
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSize() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -100,7 +100,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
         verifyStats(dest, 200, publishedMessageSize.get());
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeAfterConsumption() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -112,7 +112,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
         verifyStats(dest, 0, 0);
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeOneDurable() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
@@ -133,7 +133,7 @@ public abstract class AbstractMessageStoreSizeStatTest extends AbstractStoreStat
         connection.close();
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeTwoDurables() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractStoreStatTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractStoreStatTestSupport.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractStoreStatTestSupport.java
index 085becb..e0e8992 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractStoreStatTestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/AbstractStoreStatTestSupport.java
@@ -179,8 +179,7 @@ public abstract class AbstractStoreStatTestSupport {
             MessageProducer prod = session.createProducer(queue);
             prod.setDeliveryMode(deliveryMode);
             for (int i = 0; i < count; i++) {
-                LOG.info("Publishing message: " + i + ", size: " + messageSize);
-                prod.send(createMessage(session, messageSize, publishedMessageSize));
+                prod.send(createMessage(i, session, messageSize, publishedMessageSize));
             }
 
         } finally {
@@ -230,8 +229,7 @@ public abstract class AbstractStoreStatTestSupport {
             MessageProducer prod = session.createProducer(topic);
             prod.setDeliveryMode(deliveryMode);
             for (int i = 0; i < publishSize; i++) {
-                LOG.info("Publishing message: " + i + ", size: " + messageSize);
-                prod.send(createMessage(session, messageSize, publishedMessageSize));
+                prod.send(createMessage(i, session, messageSize, publishedMessageSize));
             }
 
             //verify the view has expected messages
@@ -254,14 +252,17 @@ public abstract class AbstractStoreStatTestSupport {
     }
 
     /**
-     * Generate random messages between 100 bytes and messageSize
+     * Generate random messages between 100 bytes and maxMessageSize
      * @param session
      * @return
      * @throws JMSException
      */
-    protected BytesMessage createMessage(Session session, int messageSize, AtomicLong publishedMessageSize)
throws JMSException {
+    protected BytesMessage createMessage(int count, Session session, int maxMessageSize,
AtomicLong publishedMessageSize) throws JMSException {
         final BytesMessage message = session.createBytesMessage();
-        int size = messageSize;
+
+        final Random randomSize = new Random();
+        int size = randomSize.nextInt((maxMessageSize - 100) + 1) + 100;
+        LOG.info("Creating message to publish: " + count + ", size: " + size);
         if (publishedMessageSize != null) {
             publishedMessageSize.addAndGet(size);
         }

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBMessageStoreSizeStatTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBMessageStoreSizeStatTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBMessageStoreSizeStatTest.java
index 276a310..5a302ca 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBMessageStoreSizeStatTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBMessageStoreSizeStatTest.java
@@ -65,7 +65,7 @@ public class KahaDBMessageStoreSizeStatTest extends
      *
      * @throws Exception
      */
-    @Test
+    @Test(timeout=30000)
     public void testMessageSizeAfterRestartAndPublish() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Destination dest = publishTestQueueMessages(200, publishedMessageSize);

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/MultiKahaDBMessageStoreSizeStatTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/MultiKahaDBMessageStoreSizeStatTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/MultiKahaDBMessageStoreSizeStatTest.java
index 3572acc..0adfcff 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/MultiKahaDBMessageStoreSizeStatTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/MultiKahaDBMessageStoreSizeStatTest.java
@@ -85,7 +85,7 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
      *
      * @throws Exception
      */
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeAfterRestartAndPublish() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
 
@@ -104,7 +104,7 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
 
     }
 
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeAfterRestartAndPublishMultiQueue() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         AtomicLong publishedMessageSize2 = new AtomicLong();

http://git-wip-us.apache.org/repos/asf/activemq/blob/8a09b7e5/activemq-unit-tests/src/test/java/org/apache/activemq/store/memory/MemoryMessageStoreSizeStatTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/memory/MemoryMessageStoreSizeStatTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/memory/MemoryMessageStoreSizeStatTest.java
index ba2ae33..0e8250b 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/memory/MemoryMessageStoreSizeStatTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/memory/MemoryMessageStoreSizeStatTest.java
@@ -47,7 +47,7 @@ public class MemoryMessageStoreSizeStatTest extends AbstractMessageStoreSizeStat
     }
 
     @Override
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeOneDurable() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
@@ -72,7 +72,7 @@ public class MemoryMessageStoreSizeStatTest extends AbstractMessageStoreSizeStat
     }
 
     @Override
-    @Test(timeout=10000)
+    @Test(timeout=30000)
     public void testMessageSizeTwoDurables() throws Exception {
         AtomicLong publishedMessageSize = new AtomicLong();
         Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();


Mime
View raw message