steveloughran commented on a change in pull request #3041:
URL: https://github.com/apache/hadoop/pull/3041#discussion_r641733928
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/TestAccountConfiguration.java
##########
@@ -361,6 +373,39 @@ public void testAccessTokenProviderPrecedence()
testGlobalAndAccountOAuthPrecedence(abfsConf, null, AuthType.OAuth);
}
+ @Test
+ public void testConfigPropNotFound() throws Exception {
+ final String accountName = "account";
+
+ final Configuration conf = new Configuration();
+ final AbfsConfiguration abfsConf = new AbfsConfiguration(conf,
accountName);
+
+ for (String key : CONFIG_KEYS) {
+ setAuthConfig(abfsConf, true, AuthType.OAuth);
+ abfsConf.unset(key + "." + accountName);
+ testMissingConfigKey(abfsConf, key);
+ }
+
+ unsetAuthConfig(abfsConf, false);
+ unsetAuthConfig(abfsConf, true);
+ }
+
+ private void testMissingConfigKey(final AbfsConfiguration abfsConf,
Review comment:
Whenever an exception doesn't match expected, its critical for the test
case to throw up that exception so we can debug what's gone wrong from the test
report alone. This one loses the stack trace on L399 and L403.
add `verifyCause` to verify cause type and
GenericTestUtils.assertExceptionContains() to process, something like
```java
assertExceptionContains("Configuration property "+confKey+" not found."),
verifyCause(ConfigurationPropertyNotFoundException.class,
intercept(TokenAccessProviderException.class,()->
abfsConf.getTokenProvider().getClass().getTypeName())));
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]