HADOOP-19150: [ABFS] Fixing Test Code for ITestAbfsRestOperationException#testAuthFailException (#6756)

Contributed by: Anuj Modi
This commit is contained in:
Anuj Modi 2024-04-29 22:18:34 +05:30 committed by GitHub
parent aa169e1093
commit a6f2c4617e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -187,21 +187,18 @@ public void testAuthFailException() throws Exception {
config.set(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, "false"); config.set(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, "false");
final AzureBlobFileSystem fs = getFileSystem(config); final AzureBlobFileSystem fs = getFileSystem(config);
try { AbfsRestOperationException e = intercept(AbfsRestOperationException.class, () -> {
intercept(Exception.class, fs.getFileStatus(new Path("/"));
() -> { });
fs.getFileStatus(new Path("/"));
}); String errorDesc = "Should throw RestOp exception on AAD failure";
} catch (AbfsRestOperationException e) { Assertions.assertThat(e.getStatusCode())
String errorDesc = "Should throw RestOp exception on AAD failure"; .describedAs("Incorrect status code: " + errorDesc).isEqualTo(-1);
Assertions.assertThat(e.getStatusCode()) Assertions.assertThat(e.getErrorCode())
.describedAs("Incorrect status code. " + errorDesc).isEqualTo(-1); .describedAs("Incorrect error code: " + errorDesc)
Assertions.assertThat(e.getErrorCode()) .isEqualTo(AzureServiceErrorCode.UNKNOWN);
.describedAs("Incorrect error code. " + errorDesc) Assertions.assertThat(e.getErrorMessage())
.isEqualTo(AzureServiceErrorCode.UNKNOWN); .describedAs("Incorrect error message: " + errorDesc)
Assertions.assertThat(e.getErrorMessage()) .contains("Auth failure: ");
.describedAs("Incorrect error message. " + errorDesc)
.contains("Auth failure: ");
}
} }
} }