Skip to content

Commit 6f1208f

Browse files
authored
Add one more IT for GitHubContainerRegistryITCase (#537)
2 parents f9697d8 + 0ab9659 commit 6f1208f

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/test/java/land/oras/GitHubContainerRegistryITCase.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
import static org.junit.jupiter.api.Assertions.assertNotNull;
2424

25-
import java.io.IOException;
2625
import java.nio.file.Path;
26+
import land.oras.utils.ArchiveUtils;
27+
import land.oras.utils.Const;
2728
import org.junit.jupiter.api.Test;
2829
import org.junit.jupiter.api.io.TempDir;
2930
import org.junit.jupiter.api.parallel.Execution;
@@ -53,7 +54,7 @@ void shouldPUllManifest() {
5354
}
5455

5556
@Test
56-
void shouldPullOneBlob() throws IOException {
57+
void shouldPullOneBlob() {
5758
Registry registry = Registry.builder().build();
5859
ContainerRef containerRef1 = ContainerRef.parse("ghcr.io/oras-project/oras:main");
5960
Index index = registry.getIndex(containerRef1);
@@ -63,4 +64,14 @@ void shouldPullOneBlob() throws IOException {
6364
registry.fetchBlob(containerRef1.withDigest(oneLayer.getDigest()), tempDir.resolve("my-blob"));
6465
assertNotNull(tempDir.resolve("my-blob"));
6566
}
67+
68+
@Test
69+
void shouldPullArtifact() {
70+
Registry registry = Registry.builder().build();
71+
ContainerRef artifact = ContainerRef.parse("ghcr.io/aquasecurity/trivy-db:2");
72+
registry.pullArtifact(artifact, tempDir, false);
73+
assertNotNull(tempDir.resolve("db.tar.gz"));
74+
ArchiveUtils.uncompressuntar(
75+
tempDir.resolve("db.tar.gz"), tempDir.resolve("db"), Const.DEFAULT_BLOB_DIR_MEDIA_TYPE);
76+
}
6677
}

0 commit comments

Comments
 (0)