HADOOP-15715. ITestAzureBlobFileSystemE2E timing out with non-scale timeout of 10 min.
Contributed by Da Zhou
This commit is contained in:
parent
1cf38a38da
commit
524776625d
|
@ -38,7 +38,6 @@ import static org.junit.Assert.assertArrayEquals;
|
|||
* 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 class ITestAzureBlobFileSystemE2E extends AbstractAbfsIntegrationTest {
|
|||
|
||||
@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 class ITestAzureBlobFileSystemE2E extends AbstractAbfsIntegrationTest {
|
|||
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 class ITestAzureBlobFileSystemE2E extends AbstractAbfsIntegrationTest {
|
|||
@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 class ITestAzureBlobFileSystemE2E extends AbstractAbfsIntegrationTest {
|
|||
@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 class ITestAzureBlobFileSystemE2E extends AbstractAbfsIntegrationTest {
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue