Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolanmol1234 committed Jun 13, 2024
1 parent d3f853e commit 3d6eda0
Showing 1 changed file with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.azurebfs.services.AbfsBlobClient;
import org.apache.hadoop.fs.azurebfs.services.AbfsClient;
import org.apache.hadoop.fs.azurebfs.services.AbfsDfsClient;

import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.DOT;
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION;
Expand Down Expand Up @@ -102,7 +103,7 @@ public void testAbfsRestOperationExceptionFormat() throws IOException {
} catch (Exception ex) {
String errorMessage = ex.getLocalizedMessage();
String[] errorFields = errorMessage.split(",");
if (!getAbfsStore(fs).getAbfsConfiguration().enableAbfsListIterator() && !(client instanceof AbfsBlobClient)) {
if (client instanceof AbfsDfsClient) {
// verify its format
// Expected Fields are: Message, StatusCode, Method, URL, ActivityId(rId), StorageErrorCode, StorageErrorMessage.
Assertions.assertThat(errorFields)
Expand Down Expand Up @@ -150,25 +151,18 @@ public void testAbfsRestOperationExceptionFormat() throws IOException {
"Number of Fields in exception message are not as expected")
.hasSize(5);
// Check status message, status code, HTTP Request Type and URL.
if (client instanceof AbfsBlobClient) {
if (getAbfsStore(fs).getAbfsConfiguration().enableAbfsListIterator()) {
Assertions.assertThat(errorFields[0].trim())
.describedAs(
"Error Message Field in exception message is wrong")
.contains(
"Operation failed: \"The specified container does not exist.\"");
} else {
Assertions.assertThat(errorFields[0].trim())
.describedAs(
"Error Message Field in exception message is wrong")
.contains(
"Operation failed: \"The specified blob does not exist.\"");
}
if (getAbfsStore(fs).getAbfsConfiguration().enableAbfsListIterator()) {
Assertions.assertThat(errorFields[0].trim())
.describedAs(
"Error Message Field in exception message is wrong")
.contains(
"Operation failed: \"The specified container does not exist.\"");
} else {
Assertions.assertThat(errorFields[0].trim())
.describedAs("Error Message Field in exception message is wrong")
.isEqualTo(
"Operation failed: \"The specified path does not exist.\"");
.describedAs(
"Error Message Field in exception message is wrong")
.contains(
"Operation failed: \"The specified blob does not exist.\"");
}
Assertions.assertThat(errorFields[1].trim())
.describedAs("Status Code Field in exception message "
Expand Down

0 comments on commit 3d6eda0

Please sign in to comment.