You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/10/22 19:04:05 UTC

jena git commit: Identify the unstable tests on windows on a loaded CI server.

Repository: jena
Updated Branches:
  refs/heads/master 245214d80 -> 3d8cbbdf7


Identify the unstable tests on windows on a loaded CI server.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/3d8cbbdf
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/3d8cbbdf
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/3d8cbbdf

Branch: refs/heads/master
Commit: 3d8cbbdf76111cb23f406b250d58346b3547a983
Parents: 245214d
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 22 18:01:07 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 22 18:01:07 2015 +0100

----------------------------------------------------------------------
 .../apache/jena/atlas/lib/TestAlarmClock.java   | 39 +++++++++++++++++---
 1 file changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/3d8cbbdf/jena-base/src/test/java/org/apache/jena/atlas/lib/TestAlarmClock.java
----------------------------------------------------------------------
diff --git a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestAlarmClock.java b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestAlarmClock.java
index 806db87..67415c4 100644
--- a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestAlarmClock.java
+++ b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestAlarmClock.java
@@ -23,11 +23,34 @@ import static org.apache.jena.atlas.lib.Lib.sleep ;
 import java.util.concurrent.atomic.AtomicInteger ;
 
 import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.base.Sys ;
+import org.junit.Assume ;
 import org.junit.Test ;
 
 public class TestAlarmClock extends BaseTest {
-    AtomicInteger count    = new AtomicInteger(0) ;
-    Runnable      callback = ()->count.getAndIncrement() ;
+    /* Issues with MS Windows.
+     * 
+     * Running some of these tests on windows is unreliable; sometimes they pass,
+     * sometimes one fails.
+     *  
+     * This seems to be that when the CI server (ASF Jenkins, Windows VM)
+     * is under load then the ScheduledThreadPoolExecutor used by AlarmClock 
+     * is unreliable.  
+     * 
+     * But setting the times so high for this slows the tests down a lot
+     * and makes some of them fairly pointless.
+     * 
+     * alarm_03 is very sensitive.  A sleep of 200 is still not stable
+     * the callback is not called (10ms callback).  It usually passses if there is
+     * no other job on the machines, otherwise it fails >50% of the time.
+     * 
+     * Failures are masking the success/failure of unrelated development changes.
+     * 
+     * So skip some tests on windows.  
+     */
+
+    private AtomicInteger count    = new AtomicInteger(0) ;
+    private Runnable      callback = ()->count.getAndIncrement() ;
 
     @Test
     public void alarm_01() {
@@ -41,10 +64,12 @@ public class TestAlarmClock extends BaseTest {
 
     @Test
     public void alarm_02() {
+        Assume.assumeTrue( ! Sys.isWindows );
+
         AlarmClock alarmClock = new AlarmClock() ;
         // Short - happens.
         alarmClock.add(callback, 10) ;
-        sleep(200) ;
+        sleep(120) ;
         assertEquals(1, count.get()) ;
         // try to cancel anyway.
         alarmClock.cancel(callback) ;
@@ -53,10 +78,12 @@ public class TestAlarmClock extends BaseTest {
 
     @Test
     public void alarm_03() {
+        Assume.assumeTrue( ! Sys.isWindows );
+        
         AlarmClock alarmClock = new AlarmClock() ;
         alarmClock.add(callback, 10) ;
         alarmClock.add(callback, 1000000) ;
-        sleep(200) ;
+        sleep(150) ;
         // ping1 went off.
         assertEquals(1, count.get()) ;
         alarmClock.cancel(callback) ;
@@ -65,10 +92,12 @@ public class TestAlarmClock extends BaseTest {
 
     @Test
     public void alarm_04() {
+        Assume.assumeTrue( ! Sys.isWindows );
+        
         AlarmClock alarmClock = new AlarmClock() ;
         alarmClock.add(callback, 10) ;
         alarmClock.add(callback, 20) ;
-        sleep(200) ;
+        sleep(100) ;
         // ping1 went off. ping2 went off.
         assertEquals(2, count.get()) ;
         alarmClock.release() ;