qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1240518 - /qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/stats/StatisticsCounterTest.java
Date Sat, 04 Feb 2012 15:20:14 GMT
Author: robbie
Date: Sat Feb  4 15:20:14 2012
New Revision: 1240518

URL: http://svn.apache.org/viewvc?rev=1240518&view=rev
Log:
QPID-3794: calculate a sleep interval to account for previous overlsleep, to help avoid ocasional
failures in StatisticsCounterTest.testPeakOutOfOrder

Applied patch from Oleksandr Rudyy <orudyy@gmail.com> (with small update to prevent
a negative value being used)

Modified:
    qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/stats/StatisticsCounterTest.java

Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/stats/StatisticsCounterTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/stats/StatisticsCounterTest.java?rev=1240518&r1=1240517&r2=1240518&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/stats/StatisticsCounterTest.java
(original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/stats/StatisticsCounterTest.java
Sat Feb  4 15:20:14 2012
@@ -106,7 +106,12 @@ public class StatisticsCounterTest exten
         Thread.sleep(1500);
         assertEquals(0.0, counter.getPeak());
         counter.registerEvent(2000, start + 1500);
-        Thread.sleep(1000L);
+
+        // make sure, that getPeak invocation occurs at "start + 2500"
+        // if test thread over-sleeps for 500+ mls
+        // the peak value can be incremented and test will fail
+        long sleep = start + 2500 - System.currentTimeMillis();
+        Thread.sleep(sleep < 0 ? 0 : sleep);
         assertEquals(0.0, counter.getPeak());
         counter.registerEvent(1000, start + 500);
         Thread.sleep(1500);



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


Mime
View raw message