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 2014/04/04 22:34:00 UTC

[15/19] git commit: ACCUMULO-2433 Ensure that we wait for teh constraint update to propagate to the tserver

ACCUMULO-2433 Ensure that we wait for teh constraint update to propagate to the tserver

This test has the potential to fail because of how `createtable -evc` is implemented.
It sets a zk property which the tserver hosting the tablet for the given table must
notice that the property changed so that it enforces the constraint.


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

Branch: refs/heads/1.5.2-SNAPSHOT
Commit: 2df0eb89e3802330eff5368aebc712cf3cbc882c
Parents: 174c678
Author: Josh Elser <el...@apache.org>
Authored: Fri Apr 4 16:16:55 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Fri Apr 4 16:16:55 2014 -0400

----------------------------------------------------------------------
 .../apache/accumulo/test/ShellServerTest.java   | 40 +++++++++++++++-----
 1 file changed, 31 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/2df0eb89/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java b/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
index 6d5be0b..e878b31 100644
--- a/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/ShellServerTest.java
@@ -447,16 +447,38 @@ public class ShellServerTest {
     final String table = name.getMethodName();
     // addauths
     exec("createtable " + table + " -evc");
-    exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() {
-      public String getErrorMessage() {
-        try {
-          Connector c = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()).getConnector("root", new PasswordToken(secret));
-          return "Current auths for root are: " + c.securityOperations().getUserAuthorizations("root").toString();
-        } catch (Exception e) {
-          return "Could not check authorizations";
-        }
+    boolean success = false;
+    // TabletServer hosting this table must see the constraint update before insert will fail properly
+    for (int i = 0; i < 9 && !success; i++) {
+      try {
+        exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() {
+          public String getErrorMessage() {
+            try {
+              Connector c = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()).getConnector("root", new PasswordToken(secret));
+              return "Current auths for root are: " + c.securityOperations().getUserAuthorizations("root").toString();
+            } catch (Exception e) {
+              return "Could not check authorizations";
+            }
+          }
+        });
+        success = true;
+      } catch (AssertionError e) {
+        Thread.sleep(200);
       }
-    });
+    }
+    // If we still couldn't do it, try again and let it fail
+    if (!success) {
+      exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() {
+        public String getErrorMessage() {
+          try {
+            Connector c = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()).getConnector("root", new PasswordToken(secret));
+            return "Current auths for root are: " + c.securityOperations().getUserAuthorizations("root").toString();
+          } catch (Exception e) {
+            return "Could not check authorizations";
+          }
+        }
+      });
+    }
     exec("addauths -s foo,bar", true);
     boolean passed = false;
     for (int i = 0; i < 50 && !passed; i++) {