HADOOP-17270. Fix testCompressorDecompressorWithExeedBufferLimit to c… (#2311)

This commit is contained in:
Masatake Iwasaki 2020-09-20 00:47:02 +09:00 committed by GitHub
parent e31a636e92
commit 364b958085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

View File

@ -72,17 +72,20 @@ public class TestCompressorDecompressor {
} }
@Test @Test
public void testCompressorDecompressorWithExeedBufferLimit() { public void testCompressorDecompressorWithExceedBufferLimit() {
int BYTE_SIZE = 100 * 1024; // input data size greater than internal buffer size.
byte[] rawData = generate(BYTE_SIZE); final int byteSize = 100 * 1024;
final int bufferSize = 64 * 1024;
byte[] rawData = generate(byteSize);
try { try {
CompressDecompressTester.of(rawData) CompressDecompressTester.of(rawData)
.withCompressDecompressPair( .withCompressDecompressPair(
new SnappyCompressor(BYTE_SIZE + BYTE_SIZE / 2), new SnappyCompressor(bufferSize),
new SnappyDecompressor(BYTE_SIZE + BYTE_SIZE / 2)) new SnappyDecompressor(bufferSize))
.withCompressDecompressPair(new Lz4Compressor(BYTE_SIZE), .withCompressDecompressPair(
new Lz4Decompressor(BYTE_SIZE)) new Lz4Compressor(bufferSize),
.withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK, new Lz4Decompressor(bufferSize))
.withTestCases(ImmutableSet.of(
CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK, CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK,
CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS, CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS,
CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM)) CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM))