vsinghal85 commented on code in PR #4117:
URL: https://github.com/apache/gobblin/pull/4117#discussion_r2099561877
##########
gobblin-utility/src/test/java/org/apache/gobblin/util/HadoopUtilsTest.java:
##########
@@ -333,4 +344,166 @@ public void testMoveToTrash() throws IOException {
Assert.assertFalse(fs.exists(hadoopUtilsTestDir));
Assert.assertTrue(fs.exists(trashPath));
}
+
+ @Test
+ public void testEnsureDirectoryExistsWithAclPreservation() throws Exception {
+ final Path testDir = new Path(new Path(TEST_DIR_PATH),
"HadoopUtilsTestDir");
+ FileSystem fs = Mockito.mock(FileSystem.class);
Review Comment:
Local filesystem does not support ACL operations, therefore It would not be
able to test using that, probably none of the existing tests were covering ACL
logic, using mockito only seemed way out to tests ACL cases
##########
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java:
##########
@@ -783,14 +816,21 @@ public static void ensureDirectoryExists(FileSystem fs,
Path path, Iterator<Owne
OwnerAndPermission ownerAndPermission =
ownerAndPermissionIterator.next();
if (path.getParent() != null) {
- ensureDirectoryExists(fs, path.getParent(),
ownerAndPermissionIterator, failIfOwnerSetFails);
+ ensureDirectoryExists(fs, path.getParent(),
ownerAndPermissionIterator, failIfOwnerSetFails, copyOnlySourceAclToDest);
}
if (!fs.mkdirs(path)) {
// fs.mkdirs returns false if path already existed. Do not overwrite
permissions
return;
}
-
+ try {
+ if (copyOnlySourceAclToDest) {
+ fs.removeAcl(path);
+ }
+ } catch(UnsupportedOperationException uoe) {
+ // ignore ACL calls through some unit tests, as it is not supported
for local FileSystem
+ log.info("removeACL operation is not supported for this file system");
Review Comment:
updated
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]