This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 5d340d490838df077cd4cf8ab8b342967ac248dd Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Feb 28 13:28:08 2024 -0500 Update GZipTest.testCompress666 to buffer its GZIPInputStream --- .../org/apache/commons/compress/compressors/GZipTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/apache/commons/compress/compressors/GZipTest.java b/src/test/java/org/apache/commons/compress/compressors/GZipTest.java index 3971c5979..62536ab60 100644 --- a/src/test/java/org/apache/commons/compress/compressors/GZipTest.java +++ b/src/test/java/org/apache/commons/compress/compressors/GZipTest.java @@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.fail; +import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -46,11 +47,11 @@ import java.util.zip.GZIPInputStream; import org.apache.commons.compress.AbstractTest; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.apache.commons.compress.archivers.tar.TarConstants; import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; import org.apache.commons.compress.compressors.gzip.GzipParameters; import org.apache.commons.io.IOUtils; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -60,16 +61,17 @@ public final class GZipTest extends AbstractTest { /** * Tests https://issues.apache.org/jira/browse/COMPRESS-666 */ - @Disabled - @Test - public void testCompress666() throws ExecutionException, InterruptedException { + @ParameterizedTest + @ValueSource(ints = { 1, 2, 4, 8, 16, 32, 64, 128 }) + public void testCompress666(final int factor) throws ExecutionException, InterruptedException { System.out.println("START"); final ExecutorService executorService = Executors.newFixedThreadPool(10); try { final List<Future<?>> tasks = IntStream.range(0, 200).mapToObj(index -> executorService.submit(() -> { TarArchiveEntry tarEntry = null; try (InputStream inputStream = getClass().getResourceAsStream("/COMPRESS-666/compress-666.tar.gz"); - TarArchiveInputStream tarInputStream = new TarArchiveInputStream(new GZIPInputStream(inputStream))) { + TarArchiveInputStream tarInputStream = new TarArchiveInputStream(new BufferedInputStream(new GZIPInputStream(inputStream)), + TarConstants.DEFAULT_RCDSIZE * factor, TarConstants.DEFAULT_RCDSIZE)) { while ((tarEntry = tarInputStream.getNextEntry()) != null) { assertNotNull(tarEntry); }