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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]