ACCUMULO-1689 Make the test take a little less time on average.

By sleeping smaller amounts of time and checking to see if our file count has 
gone down
as opposed to a single sleep and check, we can make the test run quicker for the
average user.


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

Branch: refs/heads/master
Commit: da95fd6a9d826441f6272ccab83cece1be05e43f
Parents: 76c3c84
Author: Josh Elser <els...@apache.org>
Authored: Mon Sep 9 23:52:42 2013 -0400
Committer: Josh Elser <els...@apache.org>
Committed: Mon Sep 9 23:52:42 2013 -0400

----------------------------------------------------------------------
 .../minicluster/MiniAccumuloClusterGCTest.java         | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/da95fd6a/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
----------------------------------------------------------------------
diff --git 
a/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
 
b/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
index 7c57e7e..a432f50 100644
--- 
a/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
+++ 
b/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
@@ -109,11 +109,16 @@ public class MiniAccumuloClusterGCTest {
     int fileCountAfterCompaction = FileUtils.listFiles(tables, new 
SuffixFileFilter(".rf"), TrueFileFilter.TRUE).size();
     
     // Sleep for 4s to let the GC do its thing
-    Thread.sleep(4000);
-    
-    int fileCountAfterGCWait = FileUtils.listFiles(tables, new 
SuffixFileFilter(".rf"), TrueFileFilter.TRUE).size();
+    for (int i = 1; i < 5; i++) {
+      Thread.sleep(1000);
+      int fileCountAfterGCWait = FileUtils.listFiles(tables, new 
SuffixFileFilter(".rf"), TrueFileFilter.TRUE).size();
+
+      if (fileCountAfterGCWait < fileCountAfterCompaction) {
+        return;
+      }
+    }
     
-    Assert.assertTrue("Expected to find less files after compaction and pause 
for GC", fileCountAfterGCWait < fileCountAfterCompaction);
+    Assert.fail("Expected to find less files after compaction and pause for 
GC");
   }
   
 }

Reply via email to