anujmodi2021 commented on code in PR #4262:
URL: https://github.com/apache/hadoop/pull/4262#discussion_r1689199461


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/TestAccountConfiguration.java:
##########
@@ -444,6 +439,30 @@ private static void testMissingConfigKey(final 
AbfsConfiguration abfsConf,
                 () -> abfsConf.getTokenProvider().getClass().getTypeName())));
   }
 
+  @Test
+  public void testClientAndTenantIdOptionalWhenUsingMsiTokenProvider() throws 
Throwable {
+      final String accountName = "account";
+      final Configuration conf = new Configuration();
+      final AbfsConfiguration abfsConf = new AbfsConfiguration(conf, 
accountName);
+
+      final String accountNameSuffix = "." + abfsConf.getAccountName();
+      String authKey = FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME + 
accountNameSuffix;
+      String providerClassKey = "";
+      String providerClassValue = "";
+
+      providerClassKey = FS_AZURE_ACCOUNT_TOKEN_PROVIDER_TYPE_PROPERTY_NAME + 
accountNameSuffix;
+      providerClassValue = TEST_OAUTH_MSI_TOKEN_PROVIDER_CLASS_CONFIG;
+
+      abfsConf.set(authKey, AuthType.OAuth.toString());
+      abfsConf.set(providerClassKey, providerClassValue);
+
+      AccessTokenProvider tokenProviderTypeName = abfsConf.getTokenProvider();
+      // Test that we managed to instantiate an MsiTokenProvider without 
having to define the tenant and client ID.
+      // Those 2 fields are optional as they can automatically be determined 
by the Azure Metadata service when
+      // running on an Azure VM.
+      
Assertions.assertThat(tokenProviderTypeName).isInstanceOf(MsiTokenProvider.class);

Review Comment:
   Nit: Add a description to the assertions so that if it fails, user know the 
expectation. Something like:
   `Assertions.assertThat(tokenProviderTypeName).decribedAs("Token Provider 
Should be MsiTokenProvider").isInstanceOf(MsiTokenProvider.class);`



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