bhattmanish98 commented on code in PR #7424:
URL: https://github.com/apache/hadoop/pull/7424#discussion_r1988791459


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemInitAndCreate.java:
##########
@@ -108,6 +117,33 @@ public void testNoGetAclCallOnHnsConfigPresence() throws 
Exception {
         .getAclStatus(Mockito.anyString(), any(TracingContext.class));
   }
 
+  /**
+   * Test to verify that the initialization of the AzureBlobFileSystem fails
+   * when an invalid ingress service type is configured.
+   *
+   * This test sets up a configuration with an invalid ingress service type
+   * (DFS) for a Blob endpoint and expects an 
InvalidConfigurationValueException
+   * to be thrown during the initialization of the filesystem.
+   *
+   * @throws Exception if an error occurs during the test execution
+   */
+  @Test
+  public void testFileSystemInitializationFailsForInvalidIngress() throws 
Exception {
+    assumeHnsDisabled();
+    Configuration configuration = new Configuration(getRawConfiguration());
+    String defaultUri = configuration.get(FS_DEFAULT_NAME_KEY);
+    String accountKey = configuration.get(
+        accountProperty(FS_AZURE_ACCOUNT_KEY_PROPERTY_NAME, getAccountName()),
+        configuration.get(FS_AZURE_ACCOUNT_KEY_PROPERTY_NAME));
+    configuration.set(FS_AZURE_ACCOUNT_KEY_PROPERTY_NAME,
+        accountKey.replace(ABFS_DFS_DOMAIN_NAME, ABFS_BLOB_DOMAIN_NAME));
+    configuration.set(FS_AZURE_INGRESS_SERVICE_TYPE, 
AbfsServiceType.DFS.name());
+    String blobUri = defaultUri.replace(ABFS_DFS_DOMAIN_NAME, 
ABFS_BLOB_DOMAIN_NAME);
+    intercept(InvalidConfigurationValueException.class,
+        "Ingress Type Cannot be DFS for Blob endpoint configured filesystem", 
() ->

Review Comment:
   We are using same string at two places, it would be better to define 
constant in AbfsError and use it at both the places.



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