ctubbsii commented on code in PR #5334:
URL: https://github.com/apache/accumulo/pull/5334#discussion_r2021405280


##########
test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java:
##########
@@ -350,4 +353,64 @@ public void testCloneMetadataTable() {
           "mc1", CloneConfiguration.empty()));
     }
   }
+
+  @Test
+  public void testCloneIntoDiffNamespace() throws Exception {
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      client.namespaceOperations().create("new");
+      client.tableOperations().clone(tableName, "new." + tableName, 
CloneConfiguration.empty());
+    }
+  }
+
+  @Test
+  public void testCloneIntoDiffNamespaceDoesntExist() throws Exception {
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      assertThrows(AccumuloException.class, () -> 
client.tableOperations().clone(tableName,
+          "missing." + tableName, CloneConfiguration.empty()));
+    }
+  }
+
+  @Test
+  public void testCloneIntoAccumuloNamespace() throws Exception {
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      assertThrows(AccumuloException.class, () -> 
client.tableOperations().clone(tableName,
+          "accumulo." + tableName, CloneConfiguration.empty()));
+    }
+  }
+
+  @Test
+  public void testCloneNamespacePermissions() throws Exception {
+    final String tableName = getUniqueNames(1)[0];
+    final String newUserName = "NEW_USER";
+    final String srcNs = "src";
+    final String srcTableName = srcNs + "." + tableName;
+    final String destNs = "dst";
+    final String dstTableName = destNs + "." + tableName;
+
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      client.namespaceOperations().create(srcNs);
+      client.tableOperations().create(srcTableName);
+      client.namespaceOperations().create(destNs);
+      client.securityOperations().createLocalUser(newUserName, new 
PasswordToken(newUserName));
+      // User needs WRITE or ALTER_TABLE on the src table to flush it as part 
of the clone operation
+      client.securityOperations().grantTablePermission(newUserName, 
srcTableName,
+          TablePermission.ALTER_TABLE);
+      client.securityOperations().grantTablePermission(newUserName, 
srcTableName,
+          TablePermission.READ);

Review Comment:
   Okay, I would also feel more comfortable having @keith-turner take a look at 
the fate locks to make sure they make sense. Otherwise, I think this can be 
merged.
   
   I was also concerned that you were not able to reproduce the problem in 2.1, 
because I was able to reproduce it using your test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to