@@ -645,6 +645,62 @@ void shouldPushManifestWithRegistryUrl() {
645645 });
646646 }
647647
648+ @ Test
649+ void pullArtifactWithoutLayer () {
650+ Registry registry = Registry .Builder .builder ()
651+ .defaults ("myuser" , "mypass" )
652+ .withInsecure (true )
653+ .build ();
654+ ContainerRef containerRef1 = ContainerRef .parse ("%s/empty-layers" .formatted (this .registry .getRegistry ()));
655+ Config emptyConfig = Config .empty ();
656+ Manifest manifest1 = Manifest .empty ().withConfig (emptyConfig );
657+ registry .pushConfig (containerRef1 , emptyConfig );
658+ registry .pushManifest (containerRef1 , manifest1 );
659+ assertDoesNotThrow (() -> {
660+ registry .pullArtifact (containerRef1 , artifactDir , true );
661+ });
662+ }
663+
664+ @ Test
665+ void pullArtifactShouldPullLayerWithTitleOnly () {
666+ Registry registry = Registry .Builder .builder ()
667+ .defaults ("myuser" , "mypass" )
668+ .withInsecure (true )
669+ .build ();
670+ ContainerRef containerRef1 = ContainerRef .parse ("%s/empty-layers-title" .formatted (this .registry .getRegistry ()));
671+ Config emptyConfig = Config .empty ();
672+ Manifest manifest1 = Manifest .empty ().withConfig (emptyConfig );
673+ Layer layer = registry .pushBlob (containerRef1 , "hello" .getBytes (StandardCharsets .UTF_8 ))
674+ .withAnnotations (Map .of (Const .ANNOTATION_TITLE , "file.txt" ));
675+ Layer layerWithoutTitle = registry .pushBlob (containerRef1 , "hello" .getBytes (StandardCharsets .UTF_8 ));
676+ manifest1 = manifest1 .withLayers (List .of (layer , layerWithoutTitle ));
677+ registry .pushConfig (containerRef1 , emptyConfig );
678+ registry .pushManifest (containerRef1 , manifest1 );
679+ assertDoesNotThrow (() -> {
680+ registry .pullArtifact (containerRef1 , artifactDir , true );
681+ });
682+ }
683+
684+ @ Test
685+ void pullArtifactShouldPullLayerWithNoTitle () {
686+ Registry registry = Registry .Builder .builder ()
687+ .defaults ("myuser" , "mypass" )
688+ .withInsecure (true )
689+ .build ();
690+ ContainerRef containerRef1 = ContainerRef .parse ("%s/no-layers-title" .formatted (this .registry .getRegistry ()));
691+ Config emptyConfig = Config .empty ();
692+ Manifest manifest1 = Manifest .empty ().withConfig (emptyConfig );
693+ Layer layer = registry .pushBlob (containerRef1 , "hello" .getBytes (StandardCharsets .UTF_8 ))
694+ .withAnnotations (Map .of ());
695+ Layer layerWithoutTitle = registry .pushBlob (containerRef1 , "hello" .getBytes (StandardCharsets .UTF_8 ));
696+ manifest1 = manifest1 .withLayers (List .of (layer , layerWithoutTitle ));
697+ registry .pushConfig (containerRef1 , emptyConfig );
698+ registry .pushManifest (containerRef1 , manifest1 );
699+ assertDoesNotThrow (() -> {
700+ registry .pullArtifact (containerRef1 , artifactDir , true );
701+ });
702+ }
703+
648704 @ Test
649705 void shouldPushComplexArtifactWithConfigMediaType () throws IOException {
650706 Registry registry = Registry .Builder .builder ()
0 commit comments