accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/5] accumulo git commit: ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests
Date Wed, 27 May 2015 20:54:48 GMT
ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests


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

Branch: refs/heads/master
Commit: 7bd66343a4d56d9199ad02727359476394f8f3b0
Parents: b477dbc
Author: Josh Elser <elserj@apache.org>
Authored: Wed May 27 16:44:38 2015 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Wed May 27 16:49:17 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/proxy/SimpleProxyBase.java  | 32 ++++++++++++++------
 1 file changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bd66343/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
index efdc4f1..1e071df 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
@@ -1122,7 +1122,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT {
     }
 
     boolean success = false;
-    for (int i = 0; i < 5; i++) {
+    for (int i = 0; i < 15; i++) {
       String batchWriter = client.createWriter(creds, table, writerOptions);
       client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
       client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
@@ -1165,7 +1165,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT {
     writerOptions.setTimeoutMs(100000);
 
     success = false;
-    for (int i = 0; i < 5; i++) {
+    for (int i = 0; i < 15; i++) {
       try {
         String batchWriter = client.createWriter(creds, table, writerOptions);
 
@@ -1658,15 +1658,29 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT
{
     assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta",
"seq", "3"}, {"00346", "meta", "seq", "1"},
         {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, table);
 
-    // test a mutation that violated a constraint
-    updates.clear();
-    updates.put(s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")),
Arrays.asList(newColUpdate("data", "count", "A"))));
+    ConditionalStatus status = null;
+    for (int i = 0; i < 20; i++) {
+      // test a mutation that violated a constraint
+      updates.clear();
+      updates.put(s2bb("00347"),
+          new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")),
Arrays.asList(newColUpdate("data", "count", "A"))));
 
-    results = client.updateRowsConditionally(cwid, updates);
+      results = client.updateRowsConditionally(cwid, updates);
 
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb("00347")));
+      assertEquals(1, results.size());
+      status = results.get(s2bb("00347"));
+      if (ConditionalStatus.VIOLATED != status) {
+        log.info("ConditionalUpdate was not rejected by server due to table constraint. Sleeping
and retrying");
+        Thread.sleep(3000);
+        continue;
+      }
+
+      assertEquals(ConditionalStatus.VIOLATED, status);
+      break;
+    }
+
+    // Final check to make sure we succeeded and didn't exceed the retries
+    assertEquals(ConditionalStatus.VIOLATED, status);
 
     assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta",
"seq", "3"}, {"00346", "meta", "seq", "1"},
         {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, table);


Mime
View raw message