@@ -115,15 +115,15 @@ var _ = Describe("1.1 registry users:", func() {
115
115
})
116
116
117
117
It ("should copy an image and its referrers to a new repository" , func () {
118
- stateKeys := append (append (foobarStates , foobar .ImageReferrersStateKeys ... ), foobar .ImageReferrerConfigStateKeys ... )
118
+ stateKeys := append (append (foobar . ImageLayerStateKeys , foobar .ManifestStateKey , foobar . ImageReferrerConfigStateKeys [ 0 ] ), foobar .ImageReferrersStateKeys ... )
119
119
src := RegistryRef (ZOTHost , ArtifactRepo , foobar .Tag )
120
120
dst := RegistryRef (ZOTHost , cpTestRepo ("referrers" ), foobar .Digest )
121
121
ORAS ("cp" , "-r" , src , dst , "-v" ).MatchStatus (stateKeys , true , len (stateKeys )).Exec ()
122
122
CompareRef (src , dst )
123
123
})
124
124
125
125
It ("should copy a multi-arch image and its referrers to a new repository via tag" , func () {
126
- stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .IndexReferrerConfigStateKey )
126
+ stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .LinuxAMD64ReferrerConfigStateKey )
127
127
src := RegistryRef (ZOTHost , ArtifactRepo , ma .Tag )
128
128
dstRepo := cpTestRepo ("index-referrers" )
129
129
dst := RegistryRef (ZOTHost , dstRepo , "copiedTag" )
@@ -142,13 +142,47 @@ var _ = Describe("1.1 registry users:", func() {
142
142
Expect (len (index .Manifests )).To (Equal (1 ))
143
143
Expect (index .Manifests [0 ].Digest .String ()).To (Equal (ma .IndexReferrerDigest ))
144
144
ORAS ("manifest" , "fetch" , RegistryRef (ZOTHost , dstRepo , ma .LinuxAMD64Referrer .Digest .String ())).
145
- WithDescription ("not copy referrer of successor" ).
146
- ExpectFailure ().
145
+ WithDescription ("copy referrer of successor" ).
146
+ Exec ()
147
+ })
148
+
149
+ It ("should copy a multi-arch image and its referrers without concurrency limitation" , func () {
150
+ stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .LinuxAMD64ReferrerConfigStateKey )
151
+ src := RegistryRef (ZOTHost , ArtifactRepo , ma .Tag )
152
+ dstRepo := cpTestRepo ("index-referrers-concurrent" )
153
+ dst := RegistryRef (ZOTHost , dstRepo , "copiedTag" )
154
+ // test
155
+ ORAS ("cp" , src , dst , "-r" , "-v" , "--concurrency" , "0" ).
156
+ MatchStatus (stateKeys , true , len (stateKeys )).
157
+ MatchKeyWords ("Digest: " + ma .Digest ).
158
+ Exec ()
159
+ // validate
160
+ CompareRef (RegistryRef (ZOTHost , ImageRepo , ma .Digest ), dst )
161
+ var index ocispec.Index
162
+ bytes := ORAS ("discover" , dst , "-o" , "json" , "--artifact-type" , ma .IndexReferrerConfigStateKey .Name ).
163
+ MatchKeyWords (ma .IndexReferrerDigest ).
164
+ WithDescription ("copy image referrer" ).
165
+ Exec ().Out .Contents ()
166
+ Expect (json .Unmarshal (bytes , & index )).ShouldNot (HaveOccurred ())
167
+ Expect (len (index .Manifests )).To (Equal (1 ))
168
+ Expect (index .Manifests [0 ].Digest .String ()).To (Equal (ma .IndexReferrerDigest ))
169
+ ORAS ("manifest" , "fetch" , RegistryRef (ZOTHost , dstRepo , ma .LinuxAMD64Referrer .Digest .String ())).
170
+ WithDescription ("copy referrer of successor" ).
147
171
Exec ()
148
172
})
149
173
174
+ It ("should copy an empty index" , func () {
175
+ src := RegistryRef (ZOTHost , ImageRepo , ma .EmptyTag )
176
+ dstRepo := cpTestRepo ("empty-index" )
177
+ dst := RegistryRef (ZOTHost , dstRepo , "copiedTag" )
178
+ // test
179
+ ORAS ("cp" , src , dst , "-r" , "-v" , "--concurrency" , "0" ).Exec ()
180
+ // validate
181
+ CompareRef (RegistryRef (ZOTHost , ImageRepo , ma .EmptyTag ), dst )
182
+ })
183
+
150
184
It ("should copy a multi-arch image and its referrers to a new repository via digest" , func () {
151
- stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .IndexReferrerConfigStateKey )
185
+ stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .LinuxAMD64ReferrerConfigStateKey )
152
186
src := RegistryRef (ZOTHost , ArtifactRepo , ma .Tag )
153
187
dstRepo := cpTestRepo ("index-referrers-digest" )
154
188
dst := RegistryRef (ZOTHost , dstRepo , ma .Digest )
@@ -168,7 +202,6 @@ var _ = Describe("1.1 registry users:", func() {
168
202
Expect (index .Manifests [0 ].Digest .String ()).To (Equal (ma .IndexReferrerDigest ))
169
203
ORAS ("manifest" , "fetch" , RegistryRef (ZOTHost , dstRepo , ma .LinuxAMD64Referrer .Digest .String ())).
170
204
WithDescription ("not copy referrer of successor" ).
171
- ExpectFailure ().
172
205
Exec ()
173
206
})
174
207
@@ -270,7 +303,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() {
270
303
When ("running `cp`" , func () {
271
304
It ("should copy an image artifact and its referrers from a registry to a fallback registry" , func () {
272
305
repo := cpTestRepo ("to-fallback" )
273
- stateKeys := append (append (foobarStates , foobar .ImageReferrersStateKeys ... ), foobar .ImageReferrerConfigStateKeys ... )
306
+ stateKeys := append (append (foobar . ImageLayerStateKeys , foobar .ManifestStateKey , foobar . ImageReferrerConfigStateKeys [ 0 ] ), foobar .ImageReferrersStateKeys ... )
274
307
src := RegistryRef (ZOTHost , ArtifactRepo , foobar .SignatureImageReferrer .Digest .String ())
275
308
dst := RegistryRef (FallbackHost , repo , "" )
276
309
ORAS ("cp" , "-r" , src , dst , "-v" ).MatchStatus (stateKeys , true , len (stateKeys )).Exec ()
@@ -280,7 +313,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() {
280
313
})
281
314
It ("should copy an image artifact and its referrers from a fallback registry to a registry" , func () {
282
315
repo := cpTestRepo ("from-fallback" )
283
- stateKeys := append (append (foobarStates , foobar .ImageReferrersStateKeys ... ), foobar .ImageReferrerConfigStateKeys ... )
316
+ stateKeys := append (append (foobar . ImageLayerStateKeys , foobar .ManifestStateKey , foobar . ImageReferrerConfigStateKeys [ 0 ] ), foobar .ImageReferrersStateKeys ... )
284
317
src := RegistryRef (FallbackHost , ArtifactRepo , foobar .SBOMImageReferrer .Digest .String ())
285
318
dst := RegistryRef (ZOTHost , repo , "" )
286
319
ORAS ("cp" , "-r" , src , dst , "-v" ).MatchStatus (stateKeys , true , len (stateKeys )).Exec ()
@@ -439,7 +472,7 @@ var _ = Describe("OCI layout users:", func() {
439
472
})
440
473
441
474
It ("should copy a tagged image and its referrers from a registry to an OCI image layout" , func () {
442
- stateKeys := append (append (foobarStates , foobar .ImageReferrersStateKeys ... ), foobar .ImageReferrerConfigStateKeys ... )
475
+ stateKeys := append (append (foobar . ImageLayerStateKeys , foobar .ManifestStateKey , foobar . ImageReferrerConfigStateKeys [ 0 ] ), foobar .ImageReferrersStateKeys ... )
443
476
dst := LayoutRef (GinkgoT ().TempDir (), "copied" )
444
477
src := RegistryRef (ZOTHost , ArtifactRepo , foobar .Tag )
445
478
// test
@@ -451,7 +484,7 @@ var _ = Describe("OCI layout users:", func() {
451
484
})
452
485
453
486
It ("should copy a image and its referrers from a registry to an OCI image layout via digest" , func () {
454
- stateKeys := append (append (foobarStates , foobar .ImageReferrersStateKeys ... ), foobar .ImageReferrerConfigStateKeys ... )
487
+ stateKeys := append (append (foobar . ImageLayerStateKeys , foobar .ManifestStateKey , foobar . ImageReferrerConfigStateKeys [ 0 ] ), foobar .ImageReferrersStateKeys ... )
455
488
toDir := GinkgoT ().TempDir ()
456
489
src := RegistryRef (ZOTHost , ArtifactRepo , foobar .Digest )
457
490
// test
@@ -463,7 +496,7 @@ var _ = Describe("OCI layout users:", func() {
463
496
})
464
497
465
498
It ("should copy a multi-arch image and its referrers from a registry to an OCI image layout a via tag" , func () {
466
- stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .IndexReferrerConfigStateKey )
499
+ stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .LinuxAMD64ReferrerConfigStateKey )
467
500
src := RegistryRef (ZOTHost , ArtifactRepo , ma .Tag )
468
501
toDir := GinkgoT ().TempDir ()
469
502
dst := LayoutRef (toDir , "copied" )
@@ -485,13 +518,12 @@ var _ = Describe("OCI layout users:", func() {
485
518
Expect (len (index .Manifests )).To (Equal (1 ))
486
519
Expect (index .Manifests [0 ].Digest .String ()).To (Equal (ma .IndexReferrerDigest ))
487
520
ORAS ("manifest" , "fetch" , Flags .Layout , LayoutRef (toDir , ma .LinuxAMD64Referrer .Digest .String ())).
488
- WithDescription ("not copy referrer of successor" ).
489
- ExpectFailure ().
521
+ WithDescription ("copy referrer of successor" ).
490
522
Exec ()
491
523
})
492
524
493
525
It ("should copy a multi-arch image and its referrers from an OCI image layout to a registry via digest" , func () {
494
- stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .IndexReferrerConfigStateKey )
526
+ stateKeys := append (ma .IndexStateKeys , ma .IndexZOTReferrerStateKey , ma .LinuxAMD64ReferrerConfigStateKey )
495
527
fromDir := GinkgoT ().TempDir ()
496
528
src := LayoutRef (fromDir , ma .Tag )
497
529
dst := RegistryRef (ZOTHost , cpTestRepo ("recursive-from-layout" ), "copied" )
@@ -514,9 +546,8 @@ var _ = Describe("OCI layout users:", func() {
514
546
Expect (json .Unmarshal (bytes , & index )).ShouldNot (HaveOccurred ())
515
547
Expect (len (index .Manifests )).To (Equal (1 ))
516
548
Expect (index .Manifests [0 ].Digest .String ()).To (Equal (ma .IndexReferrerDigest ))
517
- ORAS ("manifest" , "fetch" , LayoutRef (fromDir , ma .LinuxAMD64Referrer .Digest .String ())).
518
- WithDescription ("not copy referrer of successor" ).
519
- ExpectFailure ().
549
+ ORAS ("manifest" , "fetch" , dst ).
550
+ WithDescription ("copy referrer of successor" ).
520
551
Exec ()
521
552
})
522
553
0 commit comments