GeorgeJahad commented on a change in pull request #2961:
URL: https://github.com/apache/ozone/pull/2961#discussion_r778438996



##########
File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java
##########
@@ -442,22 +461,17 @@ public void testCheckAccessForFileKey() throws Exception {
     OmKeyArgs keyArgs = createBuilder()
         .setKeyName("testdir/deep/NOTICE.txt")
         .build();
-    OpenKeySession keySession = keyManager.createFile(keyArgs, false, true);
+    OpenKeySession keySession = writeClient.createFile(keyArgs, false, true);
     keyArgs.setLocationInfoList(
         keySession.getKeyInfo().getLatestVersionLocations().getLocationList());
-    keyManager.commitKey(keyArgs, keySession.getId());
+    writeClient.commitKey(keyArgs, keySession.getId());
 
     OzoneObj fileKey = OzoneObjInfo.Builder.fromKeyArgs(keyArgs)
         .setStoreType(OzoneObj.StoreType.OZONE)
         .build();
     RequestContext context = currentUserReads();
     Assert.assertTrue(keyManager.checkAccess(fileKey, context));
 
-    OzoneObj parentDirKey = OzoneObjInfo.Builder.fromKeyArgs(keyArgs)
-        .setStoreType(OzoneObj.StoreType.OZONE)
-        .setKeyName("testdir")
-        .build();
-    Assert.assertTrue(keyManager.checkAccess(parentDirKey, context));

Review comment:
       Before these changes, the createFile() method directly invoked the 
keymanager; and the parent dir isn't created.
   Then checkAccess() of the parentDir returns true and the assert passes 
because of this code:
   
https://github.com/apache/ozone/blob/644ef956a0dec62c5427189ed44e293736e7970a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java#L1851
   
   Now the createFile() method goes through the writeClient; the missing parent 
dir is created by the OmFileCreateRequest. so then the checkAccess() assert of 
the parentDir fails.
   
   Thus, I think this parentDir test is no longer valid, and I removed it.
   




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to