Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anujmodi2021 committed Feb 4, 2025
1 parent a13ce37 commit d7d086f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,6 @@ public boolean isDfsToBlobFallbackEnabled() {
*/
public void validateConfiguredServiceType(boolean isHNSEnabled)
throws InvalidConfigurationValueException {
// TODO: [FnsOverBlob][HADOOP-19179] Remove this check when FNS over Blob is ready.
// if (getFsConfiguredServiceType() == AbfsServiceType.BLOB) {
// throw new InvalidConfigurationValueException(FS_DEFAULT_NAME_KEY,
// "Blob Endpoint Support not yet available");
// }
if (isHNSEnabled && getConfiguredServiceTypeForFNSAccounts() == AbfsServiceType.BLOB) {
throw new InvalidConfigurationValueException(
FS_AZURE_FNS_ACCOUNT_SERVICE_TYPE, "Service Type Cannot be BLOB for HNS Account");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.fs.azurebfs.utils.TracingHeaderValidator;

import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.ROOT_PATH;
import static org.apache.hadoop.test.LambdaTestUtils.intercept;

Expand Down Expand Up @@ -95,6 +96,10 @@ public void testSetGetXAttrReplace() throws Exception {
decodedAttribute2);
}

/**
* Test get and set xattr fails fine on root.
* @throws Exception if test fails
*/
@Test
public void testGetSetXAttrOnRoot() throws Exception {
AzureBlobFileSystem fs = getFileSystem();
Expand All @@ -118,6 +123,11 @@ public void testGetSetXAttrOnRoot() throws Exception {
.describedAs("SetXAttr() on root should fail with Bad Request")
.isEqualTo(HTTP_BAD_REQUEST);
}

/**
* Test get and set xattr works fine on marker blobs for directory.
* @throws Exception if test fails
*/
@Test
public void testGetSetXAttrOnExplicitDir() throws Exception {
AzureBlobFileSystem fs = getFileSystem();
Expand All @@ -128,12 +138,18 @@ public void testGetSetXAttrOnExplicitDir() throws Exception {
// Assert that the folder is now explicit
DirectoryStateHelper.isExplicitDirectory(testPath, fs, getTestTracingContext(fs, true));
}

/**
* Test get and set xattr fails fine on non-existing path.
* @throws Exception if test fails
*/
@Test
public void testGetSetXAttrOnNonExistingPath() throws Exception {
AzureBlobFileSystem fs = getFileSystem();
final Path testPath = path(getMethodName());
intercept(
FileNotFoundException.class, () -> testGetSetXAttrHelper(fs, testPath));
intercept(FileNotFoundException.class, String.valueOf(HTTP_NOT_FOUND),
"get/set XAttr() should fail for non-existing files",
() -> testGetSetXAttrHelper(fs, testPath));
}

/**
Expand Down Expand Up @@ -163,6 +179,10 @@ public void testSetXAttrMultipleOperations() throws Exception {
assertAttributeEqual(rv, attributeValue, decodedAttributeValue);
}

/**
* Test get and set xattr works fine on implicit directory and ends up creating marker blobs.
* @throws Exception if test fails
*/
@Test
public void testGetSetXAttrOnImplicitDir() throws Exception {
assumeBlobServiceType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,6 @@ public void testNoGetAclCallOnHnsConfigPresence() throws Exception {
.getAclStatus(Mockito.anyString(), any(TracingContext.class));
}

// TODO: [FnsOverBlob][HADOOP-19179] Remove this test case once Blob Endpoint Support is enabled.
@Test
public void testFileSystemInitFailsWithBlobEndpointUrl() throws Exception {
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));
String blobUri = defaultUri.replace(ABFS_DFS_DOMAIN_NAME, ABFS_BLOB_DOMAIN_NAME);
intercept(InvalidConfigurationValueException.class,
"Blob Endpoint Support not yet available", () ->
FileSystem.newInstance(new Path(blobUri).toUri(), configuration));
}

@Test
public void testFileSystemInitFailsIfNotAbleToDetermineAccountType() throws Exception {
AzureBlobFileSystem fs = ((AzureBlobFileSystem) FileSystem.newInstance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ public void testAbfsClientHandlerInitialization() throws Exception {
AbfsClientHandler clientHandler = fs.getAbfsStore().getClientHandler();
if (getAbfsServiceType() == AbfsServiceType.DFS) {
Assertions.assertThat(clientHandler.getClient()).isInstanceOf(AbfsDfsClient.class);
Assertions.assertThat(clientHandler.getIngressClient()).isInstanceOf(AbfsDfsClient.class);
} else {
Assertions.assertThat(clientHandler.getClient()).isInstanceOf(AbfsBlobClient.class);
Assertions.assertThat(clientHandler.getIngressClient()).isInstanceOf(AbfsBlobClient.class);
}
if (getIngressServiceType() == AbfsServiceType.DFS) {
Assertions.assertThat(clientHandler.getIngressClient()).isInstanceOf(AbfsDfsClient.class);
} else {
Assertions.assertThat(clientHandler.getIngressClient())
.isInstanceOf(AbfsBlobClient.class);
}
Assertions.assertThat(clientHandler.getClient(AbfsServiceType.DFS)).isInstanceOf(AbfsDfsClient.class);
Assertions.assertThat(clientHandler.getClient(AbfsServiceType.BLOB)).isInstanceOf(AbfsBlobClient.class);
Expand Down

0 comments on commit d7d086f

Please sign in to comment.