anmolanmol1234 commented on code in PR #7353:
URL: https://github.com/apache/hadoop/pull/7353#discussion_r1944510265
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java:
##########
@@ -781,6 +980,52 @@ public void testCreateSameFile() throws Exception {
.isTrue();
}
+ /**
+ * Test the creation of a file without conditional overwrite.
+ * This test sets the configuration
`fs.azure.enable.conditional.create.overwrite` to false,
+ * creates a directory, and then attempts to create a file at the same path
with overwrite set to true.
+ * It expects an IOException to be thrown.
+ *
+ * @throws Exception if any exception occurs during the test execution
+ */
+ @Test
+ public void testCreationWithoutConditionalOverwrite()
+ throws Exception {
+ final AzureBlobFileSystem currentFs = getFileSystem();
+ Configuration config = new Configuration(this.getRawConfiguration());
+ config.set("fs.azure.enable.conditional.create.overwrite",
+ String.valueOf(false));
+
+ final AzureBlobFileSystem fs =
+ (AzureBlobFileSystem) FileSystem.newInstance(currentFs.getUri(),
+ config);
+ fs.mkdirs(new Path("a/b/c"));
+ intercept(IOException.class, () -> fs.create(new Path("a/b/c"), true));
Review Comment:
taken
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java:
##########
@@ -781,6 +980,52 @@ public void testCreateSameFile() throws Exception {
.isTrue();
}
+ /**
+ * Test the creation of a file without conditional overwrite.
+ * This test sets the configuration
`fs.azure.enable.conditional.create.overwrite` to false,
+ * creates a directory, and then attempts to create a file at the same path
with overwrite set to true.
+ * It expects an IOException to be thrown.
+ *
+ * @throws Exception if any exception occurs during the test execution
+ */
+ @Test
+ public void testCreationWithoutConditionalOverwrite()
+ throws Exception {
+ final AzureBlobFileSystem currentFs = getFileSystem();
+ Configuration config = new Configuration(this.getRawConfiguration());
+ config.set("fs.azure.enable.conditional.create.overwrite",
+ String.valueOf(false));
+
+ final AzureBlobFileSystem fs =
+ (AzureBlobFileSystem) FileSystem.newInstance(currentFs.getUri(),
+ config);
+ fs.mkdirs(new Path("a/b/c"));
+ intercept(IOException.class, () -> fs.create(new Path("a/b/c"), true));
+ }
+
+ /**
+ * Test the creation of a file with overwrite set to false without
conditional overwrite.
+ * This test sets the configuration
`fs.azure.enable.conditional.create.overwrite` to false,
+ * creates a directory, and then attempts to create a file at the same path
with overwrite set to false.
+ * It expects an IOException to be thrown.
+ *
+ * @throws Exception if any exception occurs during the test execution
+ */
+ @Test
+ public void testCreationOverwriteFalseWithoutConditionalOverwrite()
+ throws Exception {
+ final AzureBlobFileSystem currentFs = getFileSystem();
+ Configuration config = new Configuration(this.getRawConfiguration());
+ config.set("fs.azure.enable.conditional.create.overwrite",
+ String.valueOf(false));
+
+ final AzureBlobFileSystem fs =
Review Comment:
taken
--
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]