You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/06/01 21:40:56 UTC

[2/9] accumulo git commit: ACCUMULO-3877 Fix the test to acct for compactions over both tablets.

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/master
Commit: c100231a644a20b48aaa8014aa6c41dfa0781ed3
Parents: 3289940
Author: Josh Elser <el...@apache.org>
Authored: Mon Jun 1 13:05:28 2015 -0400
Committer: Josh Elser <el...@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);
   }