Skip to content

Commit

Permalink
Test for commons.compress 1.26 regression (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
olevitt authored Feb 28, 2024
1 parent e2665e5 commit ab8c4bd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private void refreshPackage(CatalogWrapper cw, Pkg pkg)
}
}

private void extractDataFromTgz(InputStream in, Chart chart) throws IOException {
public void extractDataFromTgz(InputStream in, Chart chart) throws IOException {
GzipCompressorInputStream gzipIn = new GzipCompressorInputStream(in);
// HelmConfig config = null;
try (TarArchiveInputStream tarIn = new TarArchiveInputStream(gzipIn)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import fr.insee.onyxia.api.configuration.CustomObjectMapper;
import fr.insee.onyxia.api.util.TestUtils;
import fr.insee.onyxia.model.helm.Chart;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.jupiter.api.DisplayName;
Expand Down Expand Up @@ -144,4 +146,36 @@ void packageOnClassPathNotFound() {
+ "Exception occurred during loading resource: class path resource "
+ "[catalog-loader-test/keepeme1.gz]"));
}

@Test
/**
* This test is for a regression on commons compress 1.26
* https://commons.apache.org/proper/commons-compress/changes-report.html#a1.26.0 that made it
* non parallelable
*/
void shouldExtractPackageInParallel() throws IOException {
List<Chart> charts = new ArrayList<>();
for (int i = 0; i < 20; i++) {
Chart chart = new Chart();
chart.setName("vscode-python-darkmode");
charts.add(chart);
}
charts.parallelStream()
.forEach(
chart -> {
try {
catalogLoader.extractDataFromTgz(
resourceLoader
.getResource(
"classpath:/catalog-loader-test/vscode-python-darkmode-1.11.11.tgz")
.getInputStream(),
chart);
assertEquals(
19,
chart.getConfig().getProperties().getProperties().size());
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}
Binary file not shown.

0 comments on commit ab8c4bd

Please sign in to comment.