Skip to content

Commit b774e08

Browse files
authored
Add test for Helm chart extraction (Issue COMPRESS-705) (#538)
2 parents 6f1208f + ac1e0b4 commit b774e08

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,20 @@
289289

290290
</dependencies>
291291

292+
<repositories>
293+
<repository>
294+
<releases>
295+
<enabled>false</enabled>
296+
</releases>
297+
<snapshots>
298+
<enabled>true</enabled>
299+
</snapshots>
300+
<id>apache-snapshots</id>
301+
<name>apache-snapshots</name>
302+
<url>https://repository.apache.org/content/repositories/snapshots/</url>
303+
</repository>
304+
</repositories>
305+
292306
<build>
293307
<pluginManagement>
294308
<plugins>

src/test/java/land/oras/utils/ArchiveUtilsTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
package land.oras.utils;
2222

23+
import static org.junit.jupiter.api.Assertions.assertNotNull;
2324
import static org.junit.jupiter.api.Assertions.assertThrows;
2425
import static org.junit.jupiter.api.Assertions.assertTrue;
2526
import static org.mockito.Mockito.doReturn;
@@ -28,17 +29,21 @@
2829
import java.io.IOException;
2930
import java.nio.file.Files;
3031
import java.nio.file.Path;
32+
import java.nio.file.Paths;
3133
import java.nio.file.attribute.PosixFilePermission;
3234
import java.util.Set;
3335
import land.oras.LocalPath;
3436
import land.oras.exception.OrasException;
3537
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
3638
import org.junit.jupiter.api.BeforeAll;
39+
import org.junit.jupiter.api.Disabled;
3740
import org.junit.jupiter.api.Test;
3841
import org.junit.jupiter.api.io.CleanupMode;
3942
import org.junit.jupiter.api.io.TempDir;
4043
import org.junit.jupiter.api.parallel.Execution;
4144
import org.junit.jupiter.api.parallel.ExecutionMode;
45+
import org.junit.jupiter.params.ParameterizedTest;
46+
import org.junit.jupiter.params.provider.ValueSource;
4247
import org.slf4j.Logger;
4348
import org.slf4j.LoggerFactory;
4449

@@ -62,6 +67,9 @@ class ArchiveUtilsTest {
6267
@TempDir(cleanup = CleanupMode.ON_SUCCESS)
6368
private static Path targetZstdDir;
6469

70+
@TempDir(cleanup = CleanupMode.ON_SUCCESS)
71+
private static Path existingArchiveDir;
72+
6573
@BeforeAll
6674
static void beforeAll() throws Exception {
6775
// Create directory structure with few files
@@ -190,6 +198,16 @@ void shouldCreateTarGzAndExtractIt() throws Exception {
190198
assertTrue(Files.exists(temp), "Temp should exist");
191199
}
192200

201+
@ParameterizedTest
202+
@ValueSource(strings = {"jenkins-chart.tgz", "jenkins-sources.tar.gz"})
203+
@Disabled("https://issues.apache.org/jira/browse/COMPRESS-705")
204+
void shouldExtractSeveralExistingArchive(String file) {
205+
Path archive = Paths.get("src/test/resources/archives").resolve(file);
206+
assertNotNull(archive, "Archive should exist");
207+
assertTrue(Files.exists(archive), "Archive should exist");
208+
ArchiveUtils.uncompressuntar(archive, existingArchiveDir, SupportedCompression.GZIP.getMediaType());
209+
}
210+
193211
@Test
194212
void shouldCreateTarZstdAndExtractIt() throws Exception {
195213
LocalPath directory = LocalPath.of(archiveDir, Const.BLOB_DIR_ZSTD_MEDIA_TYPE);
80.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)