You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by bh...@apache.org on 2014/03/13 15:41:53 UTC
[01/10] git commit: ACCUMULO-2194 Add delay for randomwalk Security
teardown
Repository: accumulo
Updated Branches:
refs/heads/1.4.5-SNAPSHOT d11acbe5d -> ea86b44df
refs/heads/1.5.2-SNAPSHOT bf0b7f78b -> 58535fcb3
refs/heads/1.6.0-SNAPSHOT 7ed250ab9 -> 58ec7b1af
refs/heads/master 28c23e6aa -> 33b872fd0
ACCUMULO-2194 Add delay for randomwalk Security teardown
If two Security randomwalk tests run back-to-back, the second test may see that the
table user still exists even though it was removed when the first test was torn down.
This can happen if the user drop does not propagate through Zookeeper quickly enough.
This commit adds a delay to the end of the Security test to give ZK some time.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ea86b44d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ea86b44d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ea86b44d
Branch: refs/heads/1.4.5-SNAPSHOT
Commit: ea86b44dfd6f46d389a630beb33ac49b65d87cd7
Parents: d11acbe
Author: Bill Havanki <bh...@cloudera.com>
Authored: Wed Mar 12 10:51:06 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 09:30:09 2014 -0400
----------------------------------------------------------------------
.../accumulo/server/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea86b44d/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
index c20e6db..144140b 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
@@ -94,5 +94,7 @@ public class SecurityFixture extends Fixture {
log.debug("Dropping user: " + systemUserName);
conn.securityOperations().dropUser(systemUserName);
+ // Allow user drops to propagate, in case a new security test starts
+ Thread.sleep(2000);
}
}
[08/10] git commit: Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT
Posted by bh...@apache.org.
Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/58ec7b1a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/58ec7b1a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/58ec7b1a
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 58ec7b1afa8a586ff8e96f08653f405d2be5a0ff
Parents: 7ed250a 58535fc
Author: Bill Havanki <bh...@cloudera.com>
Authored: Thu Mar 13 10:40:56 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 10:40:56 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/58ec7b1a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
[10/10] git commit: Merge branch '1.6.0-SNAPSHOT'
Posted by bh...@apache.org.
Merge branch '1.6.0-SNAPSHOT'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/33b872fd
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/33b872fd
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/33b872fd
Branch: refs/heads/master
Commit: 33b872fd0cea518f41ee0fb6d2c551ae4769fb19
Parents: 28c23e6 58ec7b1
Author: Bill Havanki <bh...@cloudera.com>
Authored: Thu Mar 13 10:41:10 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 10:41:10 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/33b872fd/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
[03/10] git commit: ACCUMULO-2194 Add delay for randomwalk Security
teardown
Posted by bh...@apache.org.
ACCUMULO-2194 Add delay for randomwalk Security teardown
If two Security randomwalk tests run back-to-back, the second test may see that the
table user still exists even though it was removed when the first test was torn down.
This can happen if the user drop does not propagate through Zookeeper quickly enough.
This commit adds a delay to the end of the Security test to give ZK some time.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ea86b44d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ea86b44d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ea86b44d
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: ea86b44dfd6f46d389a630beb33ac49b65d87cd7
Parents: d11acbe
Author: Bill Havanki <bh...@cloudera.com>
Authored: Wed Mar 12 10:51:06 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 09:30:09 2014 -0400
----------------------------------------------------------------------
.../accumulo/server/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea86b44d/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
index c20e6db..144140b 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
@@ -94,5 +94,7 @@ public class SecurityFixture extends Fixture {
log.debug("Dropping user: " + systemUserName);
conn.securityOperations().dropUser(systemUserName);
+ // Allow user drops to propagate, in case a new security test starts
+ Thread.sleep(2000);
}
}
[06/10] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT
Posted by bh...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT
Conflicts:
src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/58535fcb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/58535fcb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/58535fcb
Branch: refs/heads/1.5.2-SNAPSHOT
Commit: 58535fcb3e2dfe2bc5d424947924f95d97a645b5
Parents: bf0b7f7 ea86b44
Author: Bill Havanki <bh...@cloudera.com>
Authored: Thu Mar 13 10:40:15 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 10:40:15 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/58535fcb/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --cc test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
index a6661ea,0000000..26620a4
mode 100644,000000..100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
@@@ -1,101 -1,0 +1,103 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.randomwalk.security;
+
+import java.net.InetAddress;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.SystemPermission;
+import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.test.randomwalk.Fixture;
+import org.apache.accumulo.test.randomwalk.State;
+
+public class SecurityFixture extends Fixture {
+
+ @Override
+ public void setUp(State state) throws Exception {
+ String secTableName, systemUserName, tableUserName;
+ Connector conn = state.getConnector();
+
+ String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_");
+
+ systemUserName = String.format("system_%s", hostname);
+ tableUserName = String.format("table_%s", hostname);
+ secTableName = String.format("security_%s", hostname);
+
+ if (conn.tableOperations().exists(secTableName))
+ conn.tableOperations().delete(secTableName);
+ Set<String> users = conn.securityOperations().listLocalUsers();
+ if (users.contains(tableUserName))
+ conn.securityOperations().dropLocalUser(tableUserName);
+ if (users.contains(systemUserName))
+ conn.securityOperations().dropLocalUser(systemUserName);
+
+ PasswordToken sysUserPass = new PasswordToken("sysUser");
+ conn.securityOperations().createLocalUser(systemUserName, sysUserPass);
+
+ WalkingSecurity.get(state).setTableName(secTableName);
+ state.set("rootUserPass", CredentialHelper.extractToken(state.getCredentials()));
+
+ WalkingSecurity.get(state).setSysUserName(systemUserName);
+ WalkingSecurity.get(state).createUser(systemUserName, sysUserPass);
+
+ WalkingSecurity.get(state).changePassword(tableUserName, new PasswordToken(new byte[0]));
+
+ WalkingSecurity.get(state).setTabUserName(tableUserName);
+
+ for (TablePermission tp : TablePermission.values()) {
+ WalkingSecurity.get(state).revokeTablePermission(systemUserName, secTableName, tp);
+ WalkingSecurity.get(state).revokeTablePermission(tableUserName, secTableName, tp);
+ }
+ for (SystemPermission sp : SystemPermission.values()) {
+ WalkingSecurity.get(state).revokeSystemPermission(systemUserName, sp);
+ WalkingSecurity.get(state).revokeSystemPermission(tableUserName, sp);
+ }
+ WalkingSecurity.get(state).changeAuthorizations(tableUserName, new Authorizations());
+ }
+
+ @Override
+ public void tearDown(State state) throws Exception {
+ log.debug("One last validate");
+ Validate.validate(state, log);
+ Connector conn = state.getConnector();
+
+ if (WalkingSecurity.get(state).getTableExists()) {
+ String secTableName = WalkingSecurity.get(state).getTableName();
+ log.debug("Dropping tables: " + secTableName);
+
+ conn.tableOperations().delete(secTableName);
+ }
+
+ if (WalkingSecurity.get(state).userExists(WalkingSecurity.get(state).getTabUserName())) {
+ String tableUserName = WalkingSecurity.get(state).getTabUserName();
+ log.debug("Dropping user: " + tableUserName);
+
+ conn.securityOperations().dropLocalUser(tableUserName);
+ }
+ String systemUserName = WalkingSecurity.get(state).getSysUserName();
+ log.debug("Dropping user: " + systemUserName);
+ conn.securityOperations().dropLocalUser(systemUserName);
+ WalkingSecurity.clearInstance();
+
++ // Allow user drops to propagate, in case a new security test starts
++ Thread.sleep(2000);
+ }
+}
[05/10] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT
Posted by bh...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT
Conflicts:
src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/58535fcb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/58535fcb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/58535fcb
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 58535fcb3e2dfe2bc5d424947924f95d97a645b5
Parents: bf0b7f7 ea86b44
Author: Bill Havanki <bh...@cloudera.com>
Authored: Thu Mar 13 10:40:15 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 10:40:15 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/58535fcb/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --cc test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
index a6661ea,0000000..26620a4
mode 100644,000000..100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
@@@ -1,101 -1,0 +1,103 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.randomwalk.security;
+
+import java.net.InetAddress;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.SystemPermission;
+import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.test.randomwalk.Fixture;
+import org.apache.accumulo.test.randomwalk.State;
+
+public class SecurityFixture extends Fixture {
+
+ @Override
+ public void setUp(State state) throws Exception {
+ String secTableName, systemUserName, tableUserName;
+ Connector conn = state.getConnector();
+
+ String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_");
+
+ systemUserName = String.format("system_%s", hostname);
+ tableUserName = String.format("table_%s", hostname);
+ secTableName = String.format("security_%s", hostname);
+
+ if (conn.tableOperations().exists(secTableName))
+ conn.tableOperations().delete(secTableName);
+ Set<String> users = conn.securityOperations().listLocalUsers();
+ if (users.contains(tableUserName))
+ conn.securityOperations().dropLocalUser(tableUserName);
+ if (users.contains(systemUserName))
+ conn.securityOperations().dropLocalUser(systemUserName);
+
+ PasswordToken sysUserPass = new PasswordToken("sysUser");
+ conn.securityOperations().createLocalUser(systemUserName, sysUserPass);
+
+ WalkingSecurity.get(state).setTableName(secTableName);
+ state.set("rootUserPass", CredentialHelper.extractToken(state.getCredentials()));
+
+ WalkingSecurity.get(state).setSysUserName(systemUserName);
+ WalkingSecurity.get(state).createUser(systemUserName, sysUserPass);
+
+ WalkingSecurity.get(state).changePassword(tableUserName, new PasswordToken(new byte[0]));
+
+ WalkingSecurity.get(state).setTabUserName(tableUserName);
+
+ for (TablePermission tp : TablePermission.values()) {
+ WalkingSecurity.get(state).revokeTablePermission(systemUserName, secTableName, tp);
+ WalkingSecurity.get(state).revokeTablePermission(tableUserName, secTableName, tp);
+ }
+ for (SystemPermission sp : SystemPermission.values()) {
+ WalkingSecurity.get(state).revokeSystemPermission(systemUserName, sp);
+ WalkingSecurity.get(state).revokeSystemPermission(tableUserName, sp);
+ }
+ WalkingSecurity.get(state).changeAuthorizations(tableUserName, new Authorizations());
+ }
+
+ @Override
+ public void tearDown(State state) throws Exception {
+ log.debug("One last validate");
+ Validate.validate(state, log);
+ Connector conn = state.getConnector();
+
+ if (WalkingSecurity.get(state).getTableExists()) {
+ String secTableName = WalkingSecurity.get(state).getTableName();
+ log.debug("Dropping tables: " + secTableName);
+
+ conn.tableOperations().delete(secTableName);
+ }
+
+ if (WalkingSecurity.get(state).userExists(WalkingSecurity.get(state).getTabUserName())) {
+ String tableUserName = WalkingSecurity.get(state).getTabUserName();
+ log.debug("Dropping user: " + tableUserName);
+
+ conn.securityOperations().dropLocalUser(tableUserName);
+ }
+ String systemUserName = WalkingSecurity.get(state).getSysUserName();
+ log.debug("Dropping user: " + systemUserName);
+ conn.securityOperations().dropLocalUser(systemUserName);
+ WalkingSecurity.clearInstance();
+
++ // Allow user drops to propagate, in case a new security test starts
++ Thread.sleep(2000);
+ }
+}
[09/10] git commit: Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT
Posted by bh...@apache.org.
Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/58ec7b1a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/58ec7b1a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/58ec7b1a
Branch: refs/heads/master
Commit: 58ec7b1afa8a586ff8e96f08653f405d2be5a0ff
Parents: 7ed250a 58535fc
Author: Bill Havanki <bh...@cloudera.com>
Authored: Thu Mar 13 10:40:56 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 10:40:56 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/58ec7b1a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
[07/10] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT
Posted by bh...@apache.org.
Merge branch '1.4.5-SNAPSHOT' into 1.5.2-SNAPSHOT
Conflicts:
src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/58535fcb
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/58535fcb
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/58535fcb
Branch: refs/heads/master
Commit: 58535fcb3e2dfe2bc5d424947924f95d97a645b5
Parents: bf0b7f7 ea86b44
Author: Bill Havanki <bh...@cloudera.com>
Authored: Thu Mar 13 10:40:15 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 10:40:15 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/58535fcb/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --cc test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
index a6661ea,0000000..26620a4
mode 100644,000000..100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
@@@ -1,101 -1,0 +1,103 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.randomwalk.security;
+
+import java.net.InetAddress;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.SystemPermission;
+import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.test.randomwalk.Fixture;
+import org.apache.accumulo.test.randomwalk.State;
+
+public class SecurityFixture extends Fixture {
+
+ @Override
+ public void setUp(State state) throws Exception {
+ String secTableName, systemUserName, tableUserName;
+ Connector conn = state.getConnector();
+
+ String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_");
+
+ systemUserName = String.format("system_%s", hostname);
+ tableUserName = String.format("table_%s", hostname);
+ secTableName = String.format("security_%s", hostname);
+
+ if (conn.tableOperations().exists(secTableName))
+ conn.tableOperations().delete(secTableName);
+ Set<String> users = conn.securityOperations().listLocalUsers();
+ if (users.contains(tableUserName))
+ conn.securityOperations().dropLocalUser(tableUserName);
+ if (users.contains(systemUserName))
+ conn.securityOperations().dropLocalUser(systemUserName);
+
+ PasswordToken sysUserPass = new PasswordToken("sysUser");
+ conn.securityOperations().createLocalUser(systemUserName, sysUserPass);
+
+ WalkingSecurity.get(state).setTableName(secTableName);
+ state.set("rootUserPass", CredentialHelper.extractToken(state.getCredentials()));
+
+ WalkingSecurity.get(state).setSysUserName(systemUserName);
+ WalkingSecurity.get(state).createUser(systemUserName, sysUserPass);
+
+ WalkingSecurity.get(state).changePassword(tableUserName, new PasswordToken(new byte[0]));
+
+ WalkingSecurity.get(state).setTabUserName(tableUserName);
+
+ for (TablePermission tp : TablePermission.values()) {
+ WalkingSecurity.get(state).revokeTablePermission(systemUserName, secTableName, tp);
+ WalkingSecurity.get(state).revokeTablePermission(tableUserName, secTableName, tp);
+ }
+ for (SystemPermission sp : SystemPermission.values()) {
+ WalkingSecurity.get(state).revokeSystemPermission(systemUserName, sp);
+ WalkingSecurity.get(state).revokeSystemPermission(tableUserName, sp);
+ }
+ WalkingSecurity.get(state).changeAuthorizations(tableUserName, new Authorizations());
+ }
+
+ @Override
+ public void tearDown(State state) throws Exception {
+ log.debug("One last validate");
+ Validate.validate(state, log);
+ Connector conn = state.getConnector();
+
+ if (WalkingSecurity.get(state).getTableExists()) {
+ String secTableName = WalkingSecurity.get(state).getTableName();
+ log.debug("Dropping tables: " + secTableName);
+
+ conn.tableOperations().delete(secTableName);
+ }
+
+ if (WalkingSecurity.get(state).userExists(WalkingSecurity.get(state).getTabUserName())) {
+ String tableUserName = WalkingSecurity.get(state).getTabUserName();
+ log.debug("Dropping user: " + tableUserName);
+
+ conn.securityOperations().dropLocalUser(tableUserName);
+ }
+ String systemUserName = WalkingSecurity.get(state).getSysUserName();
+ log.debug("Dropping user: " + systemUserName);
+ conn.securityOperations().dropLocalUser(systemUserName);
+ WalkingSecurity.clearInstance();
+
++ // Allow user drops to propagate, in case a new security test starts
++ Thread.sleep(2000);
+ }
+}
[04/10] git commit: ACCUMULO-2194 Add delay for randomwalk Security
teardown
Posted by bh...@apache.org.
ACCUMULO-2194 Add delay for randomwalk Security teardown
If two Security randomwalk tests run back-to-back, the second test may see that the
table user still exists even though it was removed when the first test was torn down.
This can happen if the user drop does not propagate through Zookeeper quickly enough.
This commit adds a delay to the end of the Security test to give ZK some time.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ea86b44d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ea86b44d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ea86b44d
Branch: refs/heads/master
Commit: ea86b44dfd6f46d389a630beb33ac49b65d87cd7
Parents: d11acbe
Author: Bill Havanki <bh...@cloudera.com>
Authored: Wed Mar 12 10:51:06 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 09:30:09 2014 -0400
----------------------------------------------------------------------
.../accumulo/server/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea86b44d/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
index c20e6db..144140b 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
@@ -94,5 +94,7 @@ public class SecurityFixture extends Fixture {
log.debug("Dropping user: " + systemUserName);
conn.securityOperations().dropUser(systemUserName);
+ // Allow user drops to propagate, in case a new security test starts
+ Thread.sleep(2000);
}
}
[02/10] git commit: ACCUMULO-2194 Add delay for randomwalk Security
teardown
Posted by bh...@apache.org.
ACCUMULO-2194 Add delay for randomwalk Security teardown
If two Security randomwalk tests run back-to-back, the second test may see that the
table user still exists even though it was removed when the first test was torn down.
This can happen if the user drop does not propagate through Zookeeper quickly enough.
This commit adds a delay to the end of the Security test to give ZK some time.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ea86b44d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ea86b44d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ea86b44d
Branch: refs/heads/1.5.2-SNAPSHOT
Commit: ea86b44dfd6f46d389a630beb33ac49b65d87cd7
Parents: d11acbe
Author: Bill Havanki <bh...@cloudera.com>
Authored: Wed Mar 12 10:51:06 2014 -0400
Committer: Bill Havanki <bh...@cloudera.com>
Committed: Thu Mar 13 09:30:09 2014 -0400
----------------------------------------------------------------------
.../accumulo/server/test/randomwalk/security/SecurityFixture.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/ea86b44d/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
----------------------------------------------------------------------
diff --git a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
index c20e6db..144140b 100644
--- a/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
+++ b/src/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
@@ -94,5 +94,7 @@ public class SecurityFixture extends Fixture {
log.debug("Dropping user: " + systemUserName);
conn.securityOperations().dropUser(systemUserName);
+ // Allow user drops to propagate, in case a new security test starts
+ Thread.sleep(2000);
}
}