accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/3] accumulo git commit: ACCUMULO-3834 Verify the test client can see constraints before proceeding
Date Tue, 19 May 2015 21:25:11 GMT
ACCUMULO-3834 Verify the test client can see constraints before proceeding


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

Branch: refs/heads/master
Commit: ed5b53b9329a8531ac9d7475392001f5c0f52a84
Parents: f3c1c3f
Author: Josh Elser <josh.elser@gmail.com>
Authored: Tue May 19 17:22:51 2015 -0400
Committer: Josh Elser <josh.elser@gmail.com>
Committed: Tue May 19 17:23:55 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ed5b53b9/test/src/test/java/org/apache/accumulo/test/functional/ConstraintIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConstraintIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConstraintIT.java
index a8ee9d9..c694143 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConstraintIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConstraintIT.java
@@ -21,6 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.BatchWriter;
@@ -41,8 +42,11 @@ import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
 import org.apache.accumulo.harness.AccumuloClusterIT;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ConstraintIT extends AccumuloClusterIT {
+  private static final Logger log = LoggerFactory.getLogger(ConstraintIT.class);
 
   @Override
   protected int defaultTimeoutSeconds() {
@@ -59,12 +63,24 @@ public class ConstraintIT extends AccumuloClusterIT {
       c.tableOperations().addConstraint(table, AlphaNumKeyConstraint.class.getName());
     }
 
-    // Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME);
-    // logger.setLevel(Level.TRACE);
+    // A static sleep to just let ZK do its thing
+    Thread.sleep(10 * 1000);
 
-    test1(tableNames[0]);
+    // Then check that the client has at least gotten the updates
+    for (String table : tableNames) {
+      log.debug("Checking constraints on {}", table);
+      Map<String,Integer> constraints = c.tableOperations().listConstraints(table);
+      while (!constraints.containsKey(NumericValueConstraint.class.getName()) || !constraints.containsKey(AlphaNumKeyConstraint.class.getName()))
{
+        log.debug("Failed to verify constraints. Sleeping and retrying");
+        Thread.sleep(2000);
+        constraints = c.tableOperations().listConstraints(table);
+      }
+      log.debug("Verified all constraints on {}", table);
+    }
+
+    log.debug("Verified constraints on all tables. Running tests");
 
-    // logger.setLevel(Level.TRACE);
+    test1(tableNames[0]);
 
     test2(tableNames[1], false);
     test2(tableNames[2], true);


Mime
View raw message