Repository: accumulo
Updated Branches:
  refs/heads/1.7 3289940fb -> d71e5ee4c
  refs/heads/master f6bd3eecd -> 5fbd67157


ACCUMULO-3877 Fix the test to acct for compactions over both tablets.


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

Branch: refs/heads/1.7
Commit: c100231a644a20b48aaa8014aa6c41dfa0781ed3
Parents: 3289940
Author: Josh Elser <els...@apache.org>
Authored: Mon Jun 1 13:05:28 2015 -0400
Committer: Josh Elser <els...@apache.org>
Committed: Mon Jun 1 13:05:28 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/test/TableOperationsIT.java | 24 ++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/c100231a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java 
b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
index ced9d69..dc8f9dd 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -61,7 +61,6 @@ import org.apache.accumulo.test.functional.BadIterator;
 import org.apache.hadoop.io.Text;
 import org.apache.thrift.TException;
 import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -305,9 +304,26 @@ public class TableOperationsIT extends AccumuloClusterIT {
     Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only 
compare row, colF, colQ
     for (Map.Entry<Key,Value> entry : scanner)
       actual.put(entry.getKey(), entry.getValue());
-    Assume
-        .assumeFalse("Compaction successfully occurred due to weird timing but 
we hoped it would cancel.", HardListIterator.allEntriesToInject.equals(actual));
-    assertTrue("Scan should be empty if compaction canceled. " + "Actual is " 
+ actual, actual.isEmpty());
+    switch (actual.size()) {
+      case 3:
+        // Compaction cancel didn't happen in time
+        assertTrue(HardListIterator.allEntriesToInject.equals(actual));
+        break;
+      case 2:
+        // Compacted the first tablet (-inf, f)
+        assertEquals(HardListIterator.allEntriesToInject.headMap(new 
Key("f")), actual);
+        break;
+      case 1:
+        // Compacted the second tablet [f, +inf)
+        assertEquals(HardListIterator.allEntriesToInject.tailMap(new 
Key("f")), actual);
+        break;
+      case 0:
+        // Cancelled the compaction before it ran. No generated entries.
+        break;
+      default:
+        Assert.fail("Unexpected number of entries");
+        break;
+    }
     connector.tableOperations().delete(tableName);
   }
 

Reply via email to