Skip to content

Commit

Permalink
fix for all ingress types
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolanmol1234 committed Jun 7, 2024
1 parent 41e4d03 commit 3d4584b
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
import org.mockito.Mockito;

Expand All @@ -42,18 +43,15 @@
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType;
import org.apache.hadoop.fs.azurebfs.constants.FSOperationType;
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AbfsRestOperationException;
import org.apache.hadoop.fs.azurebfs.contracts.services.AppendRequestParameters;
import org.apache.hadoop.fs.azurebfs.security.ContextEncryptionAdapter;
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 org.apache.hadoop.fs.azurebfs.services.AbfsOutputStream;
import org.apache.hadoop.fs.azurebfs.services.AzureBlobIngressHandler;
import org.apache.hadoop.fs.azurebfs.services.AzureDFSIngressHandler;
import org.apache.hadoop.fs.azurebfs.services.AzureIngressHandler;
import org.apache.hadoop.fs.azurebfs.utils.TracingContext;
import org.apache.hadoop.fs.azurebfs.utils.TracingHeaderValidator;
import org.apache.hadoop.fs.contract.ContractTestUtils;
import org.apache.hadoop.fs.permission.FsAction;
Expand Down Expand Up @@ -309,6 +307,9 @@ public void testRecreateAppendAndFlush() throws IOException {
final AzureBlobFileSystem fs = getFileSystem();
final Path filePath = path(TEST_FILE_PATH);
fs.create(filePath);
AbfsServiceType serviceType = fs.getAbfsStore().getAbfsConfiguration().getIngressServiceType();
AbfsClient abfsClient = fs.getAbfsStore().getClientHandler().getClient(serviceType);
Assume.assumeTrue("Skipping for DFS client", abfsClient instanceof AbfsBlobClient);
FSDataOutputStream outputStream = fs.append(filePath);
outputStream.write(10);
final AzureBlobFileSystem fs1 = (AzureBlobFileSystem) FileSystem.newInstance(getRawConfiguration());
Expand Down Expand Up @@ -467,6 +468,9 @@ public void testParallelWriteOutputStreamClose() throws Exception {
List<Future<?>> futures = new ArrayList<>();

FSDataOutputStream out1 = fs.create(SECONDARY_FILE_PATH);
AbfsServiceType serviceType = fs.getAbfsStore().getAbfsConfiguration().getIngressServiceType();
AbfsClient abfsClient = fs.getAbfsStore().getClientHandler().getClient(serviceType);
Assume.assumeTrue("Skipping for DFS client", abfsClient instanceof AbfsBlobClient);
AbfsOutputStream outputStream1 = (AbfsOutputStream) out1.getWrappedStream();
String fileETag = outputStream1.getIngressHandler().getETag();
final byte[] b1 = new byte[8 * ONE_MB];
Expand Down Expand Up @@ -548,7 +552,9 @@ public void testEtagMismatch() throws Exception {
final Path filePath = path(TEST_FILE_PATH);
FSDataOutputStream out1 = fs.create(filePath);
FSDataOutputStream out2 = fs.create(filePath);

AbfsServiceType serviceType = fs.getAbfsStore().getAbfsConfiguration().getIngressServiceType();
AbfsClient abfsClient = fs.getAbfsStore().getClientHandler().getClient(serviceType);
Assume.assumeTrue("Skipping for DFS client", abfsClient instanceof AbfsBlobClient);
out2.write(10);
out2.hsync();
out1.write(10);
Expand Down

0 comments on commit 3d4584b

Please sign in to comment.