Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e): add specs for oras discover #828

Merged
merged 91 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
d17b0a4
add test and fix license
qweeah Jan 16, 2023
f4e7398
Remove focused
qweeah Jan 16, 2023
ee2436d
add fallback
qweeah Jan 16, 2023
8222fd0
code clean
qweeah Jan 18, 2023
f03a6aa
add mount data for fallback testing
qweeah Jan 18, 2023
db50edc
fix: deduplicate copy status logs
qweeah Jan 18, 2023
07eba1b
Merge branch 'fix-copy' into e2e-copy
qweeah Jan 18, 2023
e4b5dee
fix copying
qweeah Jan 18, 2023
6a5084b
fix post copy
qweeah Jan 18, 2023
b00dc9a
Merge branch 'fix-copy' into e2e-copy
qweeah Jan 18, 2023
bbe6b0c
bump e2e oras-go
qweeah Jan 18, 2023
f52682c
deduplicate based on digest
qweeah Jan 18, 2023
66eb21e
Merge branch 'fix-copy' into e2e-copy
qweeah Jan 18, 2023
41b7371
revert copy change
qweeah Jan 18, 2023
ae063cb
add test
qweeah Jan 18, 2023
f0aa94b
Merge remote-tracking branch 'origin_src/main' into e2e-copy
qweeah Jan 18, 2023
be1ffd9
fix e2e
qweeah Jan 18, 2023
a264e84
use billy's fork for testing
qweeah Jan 18, 2023
5aac978
correct version
qweeah Jan 18, 2023
cabd2b6
Merge remote-tracking branch 'origin_src/main' into e2e-copy
qweeah Jan 29, 2023
b5429cc
add test data for fallback registry
qweeah Jan 29, 2023
c962337
add test scripts for e2e
qweeah Feb 9, 2023
e90901b
Merge remote-tracking branch 'origin_src/main' into e2e-copy
qweeah Feb 9, 2023
bffc5b9
add logs
qweeah Feb 9, 2023
bbbf9a6
correct git action variables
qweeah Feb 9, 2023
4c6ad45
add action logs
qweeah Feb 9, 2023
755a436
rewrite host names
qweeah Feb 9, 2023
e1dec73
use shell script to run tests
qweeah Feb 9, 2023
ceb86de
fix typo
qweeah Feb 9, 2023
94f029f
correct ci path
qweeah Feb 9, 2023
543657d
resolve script errors
qweeah Feb 9, 2023
eadc5f6
correct test scripts
qweeah Feb 9, 2023
615bae1
update scripts
qweeah Feb 9, 2023
e8a920d
add sh
qweeah Feb 9, 2023
767a036
add license checker
qweeah Feb 9, 2023
88ce722
add cleanup
qweeah Feb 9, 2023
5590b9c
add docs
qweeah Feb 9, 2023
dcf3101
more docs
qweeah Feb 9, 2023
d625470
code clean
qweeah Feb 9, 2023
c919057
add execute permission to scripts
qweeah Feb 9, 2023
a0e2c18
rename script
qweeah Feb 9, 2023
bad0fc9
add container stopping logs
qweeah Feb 10, 2023
78d4c37
doc clean
qweeah Feb 10, 2023
58f7144
use pushd instead
qweeah Feb 10, 2023
1d1786a
run distribution as current user
qweeah Feb 10, 2023
2d7aff7
add exiting trap
qweeah Feb 10, 2023
8276913
add fallback registry to registry
qweeah Feb 10, 2023
ef06747
doc update
qweeah Feb 10, 2023
ca1b183
fix error in doc
qweeah Feb 12, 2023
a20d0c8
Merge remote-tracking branch 'origin_src/main' into e2e-copy
qweeah Feb 13, 2023
a62f7ee
fix typo
qweeah Feb 13, 2023
65004e6
test(e2e): add e2e specs for `oras attach`
qweeah Feb 13, 2023
1998210
code clean
qweeah Feb 13, 2023
e0cf07f
test(e2e): add specs for `oras discover`
qweeah Feb 13, 2023
d38af2b
Merge remote-tracking branch 'origin_src/main' into e2e-attach
qweeah Feb 15, 2023
7ec6ee7
add test data for cp
qweeah Feb 15, 2023
e978ca0
test: use dedicated package for test data
qweeah Feb 16, 2023
e4e4223
move digest constant
qweeah Feb 16, 2023
5e1f858
move constants to dedicated pkg
qweeah Feb 16, 2023
1837cad
update readme and consts
qweeah Feb 16, 2023
5d0199c
add e2e for recursive copying with platforms
qweeah Feb 16, 2023
f02cafb
add test cases
qweeah Feb 16, 2023
53f9b56
add e2e tests
qweeah Feb 16, 2023
809b2f4
Merge remote-tracking branch 'origin_src/main' into fix-copy-platform
qweeah Feb 16, 2023
dfcaac8
bump ginkgo
qweeah Feb 16, 2023
38fac21
code clean
qweeah Feb 16, 2023
89c2e35
revert attach changes
qweeah Feb 16, 2023
ff09a66
add import
qweeah Feb 16, 2023
c77839f
fix e2e
qweeah Feb 16, 2023
6f752df
fix e2e
qweeah Feb 16, 2023
f51d578
show correct source digest
qweeah Feb 16, 2023
7916770
fix e2e
qweeah Feb 16, 2023
695eca0
Merge remote-tracking branch 'origin_src/main' into fix-copy-platform
qweeah Feb 16, 2023
c7094d6
doc clean
qweeah Feb 16, 2023
cf0337f
code clean
qweeah Feb 17, 2023
79f5312
Merge branch 'fix-copy-platform' into e2e-discover
qweeah Feb 17, 2023
68af77c
test(e2e): add discover e2e specs
qweeah Feb 17, 2023
dca974b
add table test
qweeah Feb 17, 2023
2c5bb0b
add test case
qweeah Feb 17, 2023
91587d4
check in affected code
qweeah Feb 17, 2023
91c3375
add module info
qweeah Feb 17, 2023
a1ba6f7
change constant
qweeah Feb 17, 2023
d2b6f5c
fix e2e
qweeah Feb 17, 2023
9fc2299
fix e2e
qweeah Feb 17, 2023
06e725d
fix e2e
qweeah Feb 17, 2023
f1010f9
Merge branch 'main' into e2e-discover
qweeah Feb 23, 2023
f02ef78
Merge branch 'e2e-discover' of https://github.com/qweeah/oras into e2…
qweeah Feb 23, 2023
f06abdc
fix e2e
qweeah Feb 23, 2023
9b782a2
revert liscense change
qweeah Feb 23, 2023
005553f
update module
qweeah Feb 23, 2023
c5ca12a
Merge remote-tracking branch 'origin_src/main' into e2e-discover
qweeah Feb 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions test/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ module oras.land/oras/test/e2e
go 1.20

require (
github.com/onsi/ginkgo/v2 v2.8.1
github.com/onsi/gomega v1.26.0
github.com/onsi/ginkgo/v2 v2.8.3
github.com/onsi/gomega v1.27.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0-rc2
gopkg.in/yaml.v2 v2.4.0
oras.land/oras-go/v2 v2.0.0
)

require (
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/tools v0.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
30 changes: 26 additions & 4 deletions test/e2e/go.sum
Original file line number Diff line number Diff line change
@@ -1,27 +1,49 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/onsi/ginkgo/v2 v2.8.1 h1:xFTEVwOFa1D/Ty24Ws1npBWkDYEV9BqZrsDxVrVkrrU=
github.com/onsi/ginkgo/v2 v2.8.1/go.mod h1:N1/NbDngAFcSLdyZ+/aYTYGSlq9qMCS/cNKGJjy+csc=
github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q=
github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/onsi/ginkgo/v2 v2.8.3 h1:RpbK1G8nWPNaCVFBWsOGnEQQGgASi6b8fxcWBvDYjxQ=
github.com/onsi/ginkgo/v2 v2.8.3/go.mod h1:6OaUA8BCi0aZfmzYT/q9AacwTzDpNbxILUT+TlBq6MY=
github.com/onsi/gomega v1.27.0 h1:QLidEla4bXUuZVFa4KX6JHCsuGgbi85LC/pCHrt/O08=
github.com/onsi/gomega v1.27.0/go.mod h1:i189pavgK95OSIipFBa74gC2V4qrQuvjuyGEr3GmbXA=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034=
github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
oras.land/oras-go/v2 v2.0.0 h1:+LRAz92WF7AvYQsQjPEAIw3Xb2zPPhuydjpi4pIHmc0=
Expand Down
57 changes: 49 additions & 8 deletions test/e2e/internal/testdata/foobar/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ limitations under the License.

package foobar

import "oras.land/oras/test/e2e/internal/utils/match"
import (
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras/test/e2e/internal/utils/match"
)

var (
Tag = "foobar"
Expand Down Expand Up @@ -63,11 +67,35 @@ func ImageConfigStateKey(configName string) match.StateKey {

// referrers
var (
SBOMImageReferrerDigest = "sha256:32b78bd00723cd7d5251d4586f84d252530b7b5fe1c4104532767e6da4e04e47"
SignatureImageReferrerDigest = "sha256:0e007dcb9ded7f49c4dc8e3eed4a446712eb6fdf08a665a4f2352d6d2f8bdf17"
SBOMArtifactReferrerDigest = "sha256:8d7a27ff2662dae183f762d281f46d626ba7b6e56a72cc9959cdbcd91aad7fbc"
SignatureArtifactReferrerDigest = "sha256:0e007dcb9ded7f49c4dc8e3eed4a446712eb6fdf08a665a4f2352d6d2f8bdf17"
ArtifactReferrerStateKeys = []match.StateKey{
SBOMImageReferrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.image.manifest.v1+json",
Digest: digest.Digest("sha256:32b78bd00723cd7d5251d4586f84d252530b7b5fe1c4104532767e6da4e04e47"),
Size: 660,
Annotations: map[string]string{
"org.opencontainers.image.created": "2023-01-18T08:37:42Z",
},
ArtifactType: "test.sbom.file",
}
SignatureImageReferrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.image.manifest.v1+json",
Digest: digest.Digest("sha256:0e007dcb9ded7f49c4dc8e3eed4a446712eb6fdf08a665a4f2352d6d2f8bdf17"),
Size: 670,
}
SBOMArtifactReferrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.artifact.manifest.v1+json",
Digest: digest.Digest("sha256:8d7a27ff2662dae183f762d281f46d626ba7b6e56a72cc9959cdbcd91aad7fbc"),
Size: 547,
Annotations: map[string]string{
"org.opencontainers.artifact.created": "2023-01-16T05:49:46Z",
},
ArtifactType: "test.sbom.file",
}
SignatureArtifactReferrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.artifact.manifest.v1+json",
Digest: digest.Digest("sha256:2dbea575a3490375f5052fbeb380a2f498866d99eb809b4168e49e224a274a39"),
Size: 560,
}
ArtifactReferrerStateKeys = []match.StateKey{
{Digest: "8d7a27ff2662", Name: "application/vnd.oci.artifact.manifest.v1+json"},
{Digest: "2dbea575a349", Name: "application/vnd.oci.artifact.manifest.v1+json"},
}
Expand All @@ -87,6 +115,19 @@ var (

// fallback referrers
var (
FallbackSignatureImageReferrerDigest = "sha256:8b3f7e000c4a6d32cd6bfcabfe874ed470d470501a09adc65afaf1c342f988ff"
FallbackSBOMImageReferrerDigest = "sha256:316405db72cc8f0212c19db23b498f9af8a456c9cd288f9e33acd1ba9e7cd534"
FallbackSignatureImageReferrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.image.manifest.v1+json",
Digest: digest.Digest("sha256:8b3f7e000c4a6d32cd6bfcabfe874ed470d470501a09adc65afaf1c342f988ff"),
Size: 670,
}

FallbackSBOMImageReferrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.image.manifest.v1+json",
Digest: digest.Digest("sha256:316405db72cc8f0212c19db23b498f9af8a456c9cd288f9e33acd1ba9e7cd534"),
Size: 660,
Annotations: map[string]string{
"org.opencontainers.image.created": "2023-01-29T02:32:18Z",
},
ArtifactType: "test.sbom.file",
}
)
28 changes: 21 additions & 7 deletions test/e2e/internal/testdata/multi_arch/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
package multi_arch

import (
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras/test/e2e/internal/utils/match"
)
Expand All @@ -35,13 +36,26 @@ var (

// child images
var (
LinuxAMD64Manifest = `{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53},"layers":[{"mediaType":"application/vnd.oci.image.layer.v1.tar","digest":"sha256:2ef548696ac7dd66ef38aab5cc8fc5cc1fb637dfaedb3a9afc89bf16db9277e1","size":10240,"annotations":{"org.opencontainers.image.title":"hello.tar"}}]}`
LinuxAMD64Digest = "sha256:9d84a5716c66a1d1b9c13f8ed157ba7d1edfe7f9b8766728b8a1f25c0d9c14c1"
LinuxAMD64Desc = `{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:9d84a5716c66a1d1b9c13f8ed157ba7d1edfe7f9b8766728b8a1f25c0d9c14c1","size":458}`
LinuxAMD64IndexDesc = `{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:9d84a5716c66a1d1b9c13f8ed157ba7d1edfe7f9b8766728b8a1f25c0d9c14c1","size":458,"platform":{"architecture":"amd64","os":"linux"}}`
LinuxAMD64Config = "{\r\n \"architecture\": \"amd64\",\r\n \"os\": \"linux\"\r\n}"
LinuxAMD64ConfigDesc = `{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53}`
LinuxAMD64ReferrerDigest = "sha256:57e6462826c85be15f22f824666f6b467d488fa7bc7e2975f43a2fae27a24ef0"
LinuxAMD64Manifest = `{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53},"layers":[{"mediaType":"application/vnd.oci.image.layer.v1.tar","digest":"sha256:2ef548696ac7dd66ef38aab5cc8fc5cc1fb637dfaedb3a9afc89bf16db9277e1","size":10240,"annotations":{"org.opencontainers.image.title":"hello.tar"}}]}`
LinuxAMD64 = ocispec.Descriptor{
MediaType: "application/vnd.oci.image.manifest.v1+json",
Digest: digest.Digest("sha256:9d84a5716c66a1d1b9c13f8ed157ba7d1edfe7f9b8766728b8a1f25c0d9c14c1"),
Size: 458,
}
LinuxAMD64DescStr = `{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:9d84a5716c66a1d1b9c13f8ed157ba7d1edfe7f9b8766728b8a1f25c0d9c14c1","size":458}`
LinuxAMD64IndexDesc = `{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:9d84a5716c66a1d1b9c13f8ed157ba7d1edfe7f9b8766728b8a1f25c0d9c14c1","size":458,"platform":{"architecture":"amd64","os":"linux"}}`
LinuxAMD64Config = "{\r\n \"architecture\": \"amd64\",\r\n \"os\": \"linux\"\r\n}"
LinuxAMD64ConfigDesc = `{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53}`
LinuxAMD64Referrer = ocispec.Descriptor{
MediaType: "application/vnd.oci.image.manifest.v1+json",
Digest: digest.Digest("sha256:57e6462826c85be15f22f824666f6b467d488fa7bc7e2975f43a2fae27a24ef0"),
Annotations: map[string]string{
"org.opencontainers.image.created": "2023-02-15T07:56:34Z",
"subject": "linux/amd64",
},
ArtifactType: "referrer.image",
Size: 481,
}
LayerName = "hello.tar"
LinuxAMD64ReferrerStateKey = match.StateKey{Digest: "57e6462826c8", Name: "application/vnd.oci.image.manifest.v1+json"}
LinuxAMD64ReferrerConfigStateKey = match.StateKey{Digest: "44136fa355b3", Name: "referrer.image"}
Expand Down
42 changes: 21 additions & 21 deletions test/e2e/suite/command/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ var _ = Describe("Common registry users:", func() {
Expect(json.Unmarshal(bytes, &index)).ShouldNot(HaveOccurred())
Expect(len(index.Manifests)).To(Equal(1))
Expect(index.Manifests[0].Digest.String()).To(Equal(ma.IndexReferrerDigest))
ORAS("manifest", "fetch", Reference(Host, dstRepo, ma.LinuxAMD64ReferrerDigest)).
ORAS("manifest", "fetch", Reference(Host, dstRepo, ma.LinuxAMD64Referrer.Digest.String())).
WithDescription("not copy referrer of successor").
ExpectFailure().
Exec()
Expand All @@ -136,7 +136,7 @@ var _ = Describe("Common registry users:", func() {
Expect(json.Unmarshal(bytes, &index)).ShouldNot(HaveOccurred())
Expect(len(index.Manifests)).To(Equal(1))
Expect(index.Manifests[0].Digest.String()).To(Equal(ma.IndexReferrerDigest))
ORAS("manifest", "fetch", Reference(Host, dstRepo, ma.LinuxAMD64ReferrerDigest)).
ORAS("manifest", "fetch", Reference(Host, dstRepo, ma.LinuxAMD64Referrer.Digest.String())).
WithDescription("not copy referrer of successor").
ExpectFailure().
Exec()
Expand All @@ -148,9 +148,9 @@ var _ = Describe("Common registry users:", func() {

ORAS("cp", src, dst, "--platform", "linux/amd64", "-v").
MatchStatus(ma.IndexStateKeys, true, len(ma.IndexStateKeys)).
MatchKeyWords("Digest: " + ma.LinuxAMD64Digest).
MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()).
Exec()
validate(Reference(Host, ImageRepo, ma.LinuxAMD64Digest), dst)
validate(Reference(Host, ImageRepo, ma.LinuxAMD64.Digest.String()), dst)
})

It("should copy a certain platform of image to a new repository via digest", func() {
Expand All @@ -159,9 +159,9 @@ var _ = Describe("Common registry users:", func() {
dst := Reference(Host, dstRepo, "")
ORAS("cp", src, dst, "--platform", "linux/amd64", "-v").
MatchStatus(ma.IndexStateKeys, true, len(ma.IndexStateKeys)).
MatchKeyWords("Digest: " + ma.LinuxAMD64Digest).
MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()).
Exec()
validate(Reference(Host, ImageRepo, ma.LinuxAMD64Digest), Reference(Host, dstRepo, ma.LinuxAMD64Digest))
validate(Reference(Host, ImageRepo, ma.LinuxAMD64.Digest.String()), Reference(Host, dstRepo, ma.LinuxAMD64.Digest.String()))
})

It("should copy a certain platform of image and its referrers to a new repository with tag", func() {
Expand All @@ -170,18 +170,18 @@ var _ = Describe("Common registry users:", func() {
dst := Reference(Host, dstRepo, "copiedTag")
ORAS("cp", src, dst, "-r", "--platform", "linux/amd64", "-v").
MatchStatus(ma.IndexStateKeys, true, len(ma.IndexStateKeys)).
MatchKeyWords("Digest: " + ma.LinuxAMD64Digest).
MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()).
Exec()
// validate
validate(Reference(Host, ImageRepo, ma.LinuxAMD64Digest), dst)
validate(Reference(Host, ImageRepo, ma.LinuxAMD64.Digest.String()), dst)
var index ocispec.Index
bytes := ORAS("discover", dst, "-o", "json", "--platform", "linux/amd64").
MatchKeyWords(ma.LinuxAMD64ReferrerDigest).
MatchKeyWords(ma.LinuxAMD64Referrer.Digest.String()).
WithDescription("discover amd64 referrers").
Exec().Out.Contents()
Expect(json.Unmarshal(bytes, &index)).ShouldNot(HaveOccurred())
Expect(len(index.Manifests)).To(Equal(1))
Expect(index.Manifests[0].Digest.String()).To(Equal(ma.LinuxAMD64ReferrerDigest))
Expect(index.Manifests[0].Digest.String()).To(Equal(ma.LinuxAMD64Referrer.Digest.String()))
ORAS("manifest", "fetch", Reference(Host, dstRepo, ma.Digest)).
WithDescription("not copy index").
ExpectFailure().
Expand All @@ -197,19 +197,19 @@ var _ = Describe("Common registry users:", func() {
dstRepo := cpTestRepo("platform-referrers-no-tag")
ORAS("cp", src, Reference(Host, dstRepo, ""), "-r", "--platform", "linux/amd64", "-v").
MatchStatus(ma.IndexStateKeys, true, len(ma.IndexStateKeys)).
MatchKeyWords("Digest: " + ma.LinuxAMD64Digest).
MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()).
Exec()
// validate
dstRef := Reference(Host, dstRepo, ma.LinuxAMD64Digest)
validate(Reference(Host, ImageRepo, ma.LinuxAMD64Digest), dstRef)
dstRef := Reference(Host, dstRepo, ma.LinuxAMD64.Digest.String())
validate(Reference(Host, ImageRepo, ma.LinuxAMD64.Digest.String()), dstRef)
var index ocispec.Index
bytes := ORAS("discover", dstRef, "-o", "json", "--platform", "linux/amd64").
MatchKeyWords(ma.LinuxAMD64ReferrerDigest).
MatchKeyWords(ma.LinuxAMD64Referrer.Digest.String()).
WithDescription("discover amd64 referrers").
Exec().Out.Contents()
Expect(json.Unmarshal(bytes, &index)).ShouldNot(HaveOccurred())
Expect(len(index.Manifests)).To(Equal(1))
Expect(index.Manifests[0].Digest.String()).To(Equal(ma.LinuxAMD64ReferrerDigest))
Expect(index.Manifests[0].Digest.String()).To(Equal(ma.LinuxAMD64Referrer.Digest.String()))
ORAS("manifest", "fetch", Reference(Host, dstRepo, ma.Digest)).
WithDescription("not copy index").
ExpectFailure().
Expand Down Expand Up @@ -244,22 +244,22 @@ var _ = Describe("OCI spec 1.0 registry users:", func() {
It("should copy an image artifact and its referrers from a registry to a fallback registry", func() {
repo := cpTestRepo("to-fallback")
stateKeys := append(append(foobarStates, foobar.ImageReferrersStateKeys...), foobar.ImageReferrerConfigStateKeys...)
src := Reference(Host, ArtifactRepo, foobar.SignatureImageReferrerDigest)
src := Reference(Host, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String())
dst := Reference(FallbackHost, repo, "")
ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec()
validate(src, Reference(FallbackHost, repo, foobar.SignatureImageReferrerDigest))
validate(src, Reference(FallbackHost, repo, foobar.SignatureImageReferrer.Digest.String()))
ORAS("discover", "-o", "tree", Reference(FallbackHost, repo, foobar.Digest)).
WithDescription("discover referrer via subject").MatchKeyWords(foobar.SignatureImageReferrerDigest, foobar.SBOMImageReferrerDigest).Exec()
WithDescription("discover referrer via subject").MatchKeyWords(foobar.SignatureImageReferrer.Digest.String(), foobar.SBOMImageReferrer.Digest.String()).Exec()
})
It("should copy an image artifact and its referrers from a fallback registry to a registry", func() {
repo := cpTestRepo("from-fallback")
stateKeys := append(append(foobarStates, foobar.FallbackImageReferrersStateKeys...), foobar.ImageReferrerConfigStateKeys...)
src := Reference(FallbackHost, ArtifactRepo, foobar.FallbackSBOMImageReferrerDigest)
src := Reference(FallbackHost, ArtifactRepo, foobar.FallbackSBOMImageReferrer.Digest.String())
dst := Reference(Host, repo, "")
ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec()
validate(src, Reference(Host, repo, foobar.FallbackSBOMImageReferrerDigest))
validate(src, Reference(Host, repo, foobar.FallbackSBOMImageReferrer.Digest.String()))
ORAS("discover", "-o", "tree", Reference(Host, repo, foobar.Digest)).
WithDescription("discover referrer via subject").MatchKeyWords(foobar.FallbackSignatureImageReferrerDigest, foobar.FallbackSBOMImageReferrerDigest).Exec()
WithDescription("discover referrer via subject").MatchKeyWords(foobar.FallbackSignatureImageReferrer.Digest.String(), foobar.FallbackSBOMImageReferrer.Digest.String()).Exec()
})
})
})
Loading