You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/15 08:23:43 UTC

[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #824: HDDS-2682: OM File create request does not check for existing directory with the same name

adoroszlai commented on a change in pull request #824: HDDS-2682: OM File create request does not check for existing directory with the same name
URL: https://github.com/apache/hadoop-ozone/pull/824#discussion_r408662054
 
 

 ##########
 File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java
 ##########
 @@ -65,6 +68,110 @@
   private int rootItemCount;
 
   @Test(timeout = 300_000)
+  public void testCreateFileShouldCheckTheExistenceOfDirWithSameName() throws Exception {
+    /*
+     * Op 1. create file -> /d1/d2/d3/d4/key2
+     * Op 2. create dir -> /d1/d2/d3/d4/key2
+     *
+     * Reverse of the above steps
+     * Op 2. create dir -> /d1/d2/d3/d4/key3
+     * Op 1. create file -> /d1/d2/d3/d4/key3
+     *
+     * Op 3. create file -> /d1/d2/d3 (d3 as a file inside /d1/d2)
+     */
+    OzoneConfiguration conf = new OzoneConfiguration();
+    cluster = MiniOzoneCluster.newBuilder(conf)
+            .setNumDatanodes(3)
+            .build();
+    cluster.waitForClusterToBeReady();
+    // create a volume and a bucket to be used by OzoneFileSystem
+    OzoneBucket bucket = TestDataUtil.createVolumeAndBucket(cluster);
+    volumeName = bucket.getVolumeName();
+    bucketName = bucket.getName();
+
+    String rootPath = String.format("%s://%s.%s/",
+            OzoneConsts.OZONE_URI_SCHEME, bucket.getName(), bucket.getVolumeName());
+
+    // Set the fs.defaultFS and start the filesystem
+    conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, rootPath);
+    fs = FileSystem.get(conf);
 
 Review comment:
   Nit: can you please extract this logic into a helper method, to avoid duplication?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org