dlmarion commented on code in PR #5334: URL: https://github.com/apache/accumulo/pull/5334#discussion_r2021448188
########## 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: I backported [this](https://github.com/apache/accumulo/pull/5334/files#diff-89ff01550cac0c44b957f8c13e910aed15aee2f419bcdcb825517ebefdf22a94R425) test to 2.1 and it fails now, so it looks like I can reproduce the issue. Odd that it didn't fail for me back on 14 Feb, maybe I did something wrong. -- 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