diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemE2E.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemE2E.java index 6021e5d51b..2e994911ac 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemE2E.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemE2E.java @@ -38,7 +38,6 @@ * Test end to end between ABFS client and ABFS server. */ public class ITestAzureBlobFileSystemE2E extends AbstractAbfsIntegrationTest { - private static final Path TEST_FILE = new Path("testfile"); private static final int TEST_BYTE = 100; private static final int TEST_OFFSET = 100; private static final int TEST_DEFAULT_BUFFER_SIZE = 4 * 1024 * 1024; @@ -52,21 +51,16 @@ public ITestAzureBlobFileSystemE2E() throws Exception { @Test public void testWriteOneByteToFile() throws Exception { - final AzureBlobFileSystem fs = getFileSystem(); - - try(FSDataOutputStream stream = fs.create(TEST_FILE)) { - stream.write(TEST_BYTE); - } - - FileStatus fileStatus = fs.getFileStatus(TEST_FILE); - assertEquals(1, fileStatus.getLen()); + final Path testFilePath = new Path(methodName.getMethodName()); + testWriteOneByteToFile(testFilePath); } @Test public void testReadWriteBytesToFile() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); - testWriteOneByteToFile(); - try(FSDataInputStream inputStream = fs.open(TEST_FILE, + final Path testFilePath = new Path(methodName.getMethodName()); + testWriteOneByteToFile(testFilePath); + try(FSDataInputStream inputStream = fs.open(testFilePath, TEST_DEFAULT_BUFFER_SIZE)) { assertEquals(TEST_BYTE, inputStream.read()); } @@ -81,17 +75,17 @@ public void testOOBWrites() throws Exception { final byte[] b = new byte[2 * readBufferSize]; new Random().nextBytes(b); - - try(FSDataOutputStream writeStream = fs.create(TEST_FILE)) { + final Path testFilePath = new Path(methodName.getMethodName()); + try(FSDataOutputStream writeStream = fs.create(testFilePath)) { writeStream.write(b); writeStream.flush(); } - try (FSDataInputStream readStream = fs.open(TEST_FILE)) { + try (FSDataInputStream readStream = fs.open(testFilePath)) { assertEquals(readBufferSize, readStream.read(bytesToRead, 0, readBufferSize)); - try (FSDataOutputStream writeStream = fs.create(TEST_FILE)) { + try (FSDataOutputStream writeStream = fs.create(testFilePath)) { writeStream.write(b); writeStream.flush(); } @@ -104,15 +98,16 @@ public void testOOBWrites() throws Exception { @Test public void testWriteWithBufferOffset() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + final Path testFilePath = new Path(methodName.getMethodName()); final byte[] b = new byte[1024 * 1000]; new Random().nextBytes(b); - try (FSDataOutputStream stream = fs.create(TEST_FILE)) { + try (FSDataOutputStream stream = fs.create(testFilePath)) { stream.write(b, TEST_OFFSET, b.length - TEST_OFFSET); } final byte[] r = new byte[TEST_DEFAULT_READ_BUFFER_SIZE]; - FSDataInputStream inputStream = fs.open(TEST_FILE, TEST_DEFAULT_BUFFER_SIZE); + FSDataInputStream inputStream = fs.open(testFilePath, TEST_DEFAULT_BUFFER_SIZE); int result = inputStream.read(r); assertNotEquals(-1, result); @@ -124,13 +119,14 @@ public void testWriteWithBufferOffset() throws Exception { @Test public void testReadWriteHeavyBytesToFileWithSmallerChunks() throws Exception { final AzureBlobFileSystem fs = getFileSystem(); + final Path testFilePath = new Path(methodName.getMethodName()); final byte[] writeBuffer = new byte[5 * 1000 * 1024]; new Random().nextBytes(writeBuffer); - write(TEST_FILE, writeBuffer); + write(testFilePath, writeBuffer); final byte[] readBuffer = new byte[5 * 1000 * 1024]; - FSDataInputStream inputStream = fs.open(TEST_FILE, TEST_DEFAULT_BUFFER_SIZE); + FSDataInputStream inputStream = fs.open(testFilePath, TEST_DEFAULT_BUFFER_SIZE); int offset = 0; while (inputStream.read(readBuffer, offset, TEST_OFFSET) > 0) { offset += TEST_OFFSET; @@ -139,4 +135,14 @@ public void testReadWriteHeavyBytesToFileWithSmallerChunks() throws Exception { assertArrayEquals(readBuffer, writeBuffer); inputStream.close(); } + + private void testWriteOneByteToFile(Path testFilePath) throws Exception { + final AzureBlobFileSystem fs = getFileSystem(); + try(FSDataOutputStream stream = fs.create(testFilePath)) { + stream.write(TEST_BYTE); + } + + FileStatus fileStatus = fs.getFileStatus(testFilePath); + assertEquals(1, fileStatus.getLen()); + } } diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/constants/TestConfigurationKeys.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/constants/TestConfigurationKeys.java index 49a0e2ee76..5565a4920e 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/constants/TestConfigurationKeys.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/constants/TestConfigurationKeys.java @@ -35,7 +35,7 @@ public final class TestConfigurationKeys { public static final String TEST_CONFIGURATION_FILE_NAME = "azure-test.xml"; public static final String TEST_CONTAINER_PREFIX = "abfs-testcontainer-"; - public static final int TEST_TIMEOUT = 10 * 60 * 1000; + public static final int TEST_TIMEOUT = 15 * 60 * 1000; private TestConfigurationKeys() {} }