cxorm commented on a change in pull request #2: HDDS-1737. Add Volume check in KeyManager and File Operations. URL: https://github.com/apache/hadoop-ozone/pull/2#discussion_r335291642
########## File path: hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/file/TestOMDirectoryCreateRequest.java ########## @@ -152,6 +152,38 @@ public void testValidateAndUpdateCache() throws Exception { } + @Test + public void testValidateAndUpdateCacheWithVolumeNotFound() throws Exception { + String volumeName = "vol1"; + String bucketName = "bucket1"; + String keyName = RandomStringUtils.randomAlphabetic(5); + for (int i =0; i< 3; i++) { + keyName += "/" + RandomStringUtils.randomAlphabetic(5); + } + + OMRequest omRequest = createDirectoryRequest(volumeName, bucketName, + keyName); + OMDirectoryCreateRequest omDirectoryCreateRequest = + new OMDirectoryCreateRequest(omRequest); + + OMRequest modifiedOmRequest = + omDirectoryCreateRequest.preExecute(ozoneManager); + + omDirectoryCreateRequest = new OMDirectoryCreateRequest(modifiedOmRequest); + + OMClientResponse omClientResponse = + omDirectoryCreateRequest.validateAndUpdateCache(ozoneManager, 100L, + ozoneManagerDoubleBufferHelper); + + Assert.assertTrue(omClientResponse.getOMResponse().getStatus() + == OzoneManagerProtocolProtos.Status.VOLUME_NOT_FOUND); + + // Key should not exist in DB + Assert.assertTrue(omMetadataManager.getKeyTable().get( Review comment: Thanks @jojochuang for the review, I am going to fix 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org