|
@@ -18,11 +18,19 @@
|
|
|
|
|
|
package org.apache.hadoop.fs.azurebfs;
|
|
|
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
+import org.junit.Assert;
|
|
|
+import org.junit.Test;
|
|
|
+
|
|
|
+import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AbfsRestOperationException;
|
|
|
import org.apache.hadoop.fs.azurebfs.services.AbfsClient;
|
|
|
import org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation;
|
|
|
-import org.junit.Assert;
|
|
|
-import org.junit.Test;
|
|
|
+
|
|
|
+import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY;
|
|
|
+import static org.apache.hadoop.fs.azurebfs.constants.TestConfigurationKeys.FS_AZURE_ACCOUNT_KEY;
|
|
|
+import static org.apache.hadoop.test.LambdaTestUtils.intercept;
|
|
|
|
|
|
/**
|
|
|
* Test continuation token which has equal sign.
|
|
@@ -46,4 +54,19 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest {
|
|
|
Assert.assertEquals("InvalidQueryParameterValue", ex.getErrorCode().getErrorCode());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void verifyUnknownHost() throws Exception {
|
|
|
+ AbfsConfiguration conf = this.getConfiguration();
|
|
|
+ String accountName = this.getAccountName();
|
|
|
+ String fakeAccountName = "fake" + UUID.randomUUID() + accountName.substring(accountName.indexOf("."));
|
|
|
+
|
|
|
+ String fsDefaultFS = conf.get(FS_DEFAULT_NAME_KEY);
|
|
|
+ conf.set(FS_DEFAULT_NAME_KEY, fsDefaultFS.replace(accountName, fakeAccountName));
|
|
|
+ conf.set(FS_AZURE_ACCOUNT_KEY + "." + fakeAccountName, this.getAccountKey());
|
|
|
+
|
|
|
+ intercept(AbfsRestOperationException.class,
|
|
|
+ "Can not reach endpoint: " + fakeAccountName,
|
|
|
+ () -> FileSystem.get(conf.getRawConfiguration()));
|
|
|
+ }
|
|
|
}
|