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): migrate oras push specs to ZOT #1085

Merged
merged 29 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f61b791
test(e2e): add zot
qweeah Aug 22, 2023
06abf60
add auth tests
qweeah Aug 22, 2023
8e644c6
uncomment changes
qweeah Aug 23, 2023
0c7a3ee
move auth and scenario suite to zot
qweeah Aug 23, 2023
35d8bd4
add password
qweeah Aug 23, 2023
1700e23
update description
qweeah Aug 23, 2023
7267ca4
separate prepare script out
qweeah Aug 23, 2023
a2cc4ea
check in zot config
qweeah Aug 23, 2023
e5f7398
add run access
qweeah Aug 23, 2023
2feed93
fix prepare bug
qweeah Aug 23, 2023
96fc889
remove prepare changes
qweeah Aug 24, 2023
2c2b597
run zot container via current user
qweeah Aug 25, 2023
6f9f3c2
rename zot
qweeah Aug 25, 2023
0a00292
add images repo for command suite and attach tests
qweeah Aug 25, 2023
3d60a75
update blob tests
qweeah Aug 25, 2023
c79ba60
Merge remote-tracking branch 'origin_src/main' into zot-attach
qweeah Aug 25, 2023
6e1998b
Merge remote-tracking branch 'origin_src/main' into zot-blob
qweeah Aug 28, 2023
d3d747b
Merge remote-tracking branch 'origin_src/main' into zot-attach
qweeah Aug 28, 2023
8efd185
add doc
qweeah Aug 28, 2023
f3cf89e
doc clean
qweeah Aug 28, 2023
8295d85
Merge branch 'zot-attach' into zot-blob
qweeah Aug 28, 2023
dea043d
fix e2e
qweeah Aug 28, 2023
1945b87
test(e2e): migrate `oras push` specs to ZOT
qweeah Aug 28, 2023
a25d23f
fix e2e
qweeah Aug 29, 2023
1e9bbd8
fix e2e
qweeah Aug 29, 2023
b42c474
Merge remote-tracking branch 'origin_src/main' into zot-blob
qweeah Aug 29, 2023
2b589d1
Merge branch 'zot-blob' into zot-push
qweeah Aug 29, 2023
5e02615
Merge remote-tracking branch 'origin_src/main' into zot-push
qweeah Aug 29, 2023
046f769
add zot known issue link
qweeah Aug 29, 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
2 changes: 2 additions & 0 deletions test/e2e/suite/command/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ var _ = Describe("1.1 registry users:", func() {
ORAS("blob", "delete", toDeleteRef).
WithInput(strings.NewReader("y")).
MatchKeyWords("Deleted", toDeleteRef).Exec()
// cannot verify the whether blob is deleted since zot will cache the blob
// https://github.com/project-zot/zot/issues/1733
})

It("should delete a blob with force flag and output descriptor", func() {
Expand Down
48 changes: 24 additions & 24 deletions test/e2e/suite/command/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("ORAS beginners:", func() {
})
})

var _ = Describe("Remote registry users:", func() {
var _ = Describe("1.1 registry users:", func() {
tag := "e2e"
When("pushing to registy without OCI artifact support", func() {
repoPrefix := fmt.Sprintf("command/push/%d", GinkgoRandomSeed())
Expand All @@ -53,7 +53,7 @@ var _ = Describe("Remote registry users:", func() {
It("should push files without customized media types", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "no-mediatype")
tempDir := PrepareTempFiles()
ref := RegistryRef(Host, repo, tag)
ref := RegistryRef(ZOTHost, repo, tag)

ORAS("push", ref, foobar.FileBarName, "-v").
MatchStatus(statusKeys, true, len(statusKeys)).
Expand All @@ -68,7 +68,7 @@ var _ = Describe("Remote registry users:", func() {

It("should push files with path validation disabled", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "disable-path-validation")
ref := RegistryRef(Host, repo, tag)
ref := RegistryRef(ZOTHost, repo, tag)
absBarName := filepath.Join(PrepareTempFiles(), foobar.FileBarName)

ORAS("push", ref, absBarName, "-v", "--disable-path-validation").
Expand All @@ -90,7 +90,7 @@ var _ = Describe("Remote registry users:", func() {

It("should fail path validation when pushing file with absolute path", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "path-validation")
ref := RegistryRef(Host, repo, tag)
ref := RegistryRef(ZOTHost, repo, tag)
absBarName := filepath.Join(PrepareTempFiles(), foobar.FileBarName)
// test
ORAS("push", ref, absBarName, "-v").
Expand All @@ -104,60 +104,60 @@ var _ = Describe("Remote registry users:", func() {
tempDir := PrepareTempFiles()
extraTag := "2e2"

ORAS("push", fmt.Sprintf("%s,%s", RegistryRef(Host, repo, tag), extraTag), foobar.FileBarName, "-v").
ORAS("push", fmt.Sprintf("%s,%s", RegistryRef(ZOTHost, repo, tag), extraTag), foobar.FileBarName, "-v").
MatchStatus(statusKeys, true, len(statusKeys)).
WithWorkDir(tempDir).Exec()

// validate
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
var manifest ocispec.Manifest
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Layers).Should(ContainElements(foobar.BlobBarDescriptor("application/vnd.oci.image.layer.v1.tar")))

fetched = ORAS("manifest", "fetch", RegistryRef(Host, repo, extraTag)).Exec().Out.Contents()
fetched = ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, extraTag)).Exec().Out.Contents()
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Layers).Should(ContainElements(foobar.BlobBarDescriptor("application/vnd.oci.image.layer.v1.tar")))
})

It("should push files with customized media types", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "layer-mediatype")
layerType := "layer.type"
layerType := "layer/type"
tempDir := PrepareTempFiles()
ORAS("push", RegistryRef(Host, repo, tag), foobar.FileBarName+":"+layerType, "-v").
ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName+":"+layerType, "-v").
MatchStatus(statusKeys, true, len(statusKeys)).
WithWorkDir(tempDir).Exec()
// validate
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
var manifest ocispec.Manifest
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Layers).Should(ContainElements(foobar.BlobBarDescriptor(layerType)))
})

It("should push files with manifest exported", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "export-manifest")
layerType := "layer.type"
layerType := "layer/type"
tempDir := PrepareTempFiles()
exportPath := "packed.json"
ORAS("push", RegistryRef(Host, repo, tag), foobar.FileBarName+":"+layerType, "-v", "--export-manifest", exportPath).
ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName+":"+layerType, "-v", "--export-manifest", exportPath).
MatchStatus(statusKeys, true, len(statusKeys)).
WithWorkDir(tempDir).Exec()
// validate
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
MatchFile(filepath.Join(tempDir, exportPath), string(fetched), DefaultTimeout)
})

It("should push files with customized config file", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "config")
tempDir := PrepareTempFiles()

ORAS("push", RegistryRef(Host, repo, tag), "--config", foobar.FileConfigName, foobar.FileBarName, "-v").
ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", foobar.FileConfigName, foobar.FileBarName, "-v").
MatchStatus([]match.StateKey{
foobar.FileConfigStateKey,
foobar.FileBarStateKey,
}, true, 2).
WithWorkDir(tempDir).Exec()
// validate
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
var manifest ocispec.Manifest
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Config).Should(Equal(ocispec.Descriptor{
Expand All @@ -168,18 +168,18 @@ var _ = Describe("Remote registry users:", func() {
})

It("should push files with customized config file and mediatype", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "config-mediatype")
configType := "config.type"
repo := fmt.Sprintf("%s/%s", repoPrefix, "config/mediatype")
configType := "config/type"
tempDir := PrepareTempFiles()

ORAS("push", RegistryRef(Host, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v").
ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v").
MatchStatus([]match.StateKey{
{Digest: "46b68ac1696c", Name: configType},
foobar.FileBarStateKey,
}, true, 2).
WithWorkDir(tempDir).Exec()
// validate
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
var manifest ocispec.Manifest
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Config).Should(Equal(ocispec.Descriptor{
Expand All @@ -195,11 +195,11 @@ var _ = Describe("Remote registry users:", func() {
value := "image-anno-value"
tempDir := PrepareTempFiles()
// test
ORAS("push", RegistryRef(Host, repo, tag), foobar.FileBarName, "-v", "--annotation", fmt.Sprintf("%s=%s", key, value)).
ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v", "--annotation", fmt.Sprintf("%s=%s", key, value)).
MatchStatus(statusKeys, true, len(statusKeys)).
WithWorkDir(tempDir).Exec()
// validate
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
var manifest ocispec.Manifest
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Annotations[key]).To(Equal(value))
Expand All @@ -209,13 +209,13 @@ var _ = Describe("Remote registry users:", func() {
repo := fmt.Sprintf("%s/%s", repoPrefix, "file-annotation")
tempDir := PrepareTempFiles()

ORAS("push", RegistryRef(Host, repo, tag), foobar.FileBarName, "-v", "--annotation-file", "foobar/annotation.json", "--config", foobar.FileConfigName).
ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v", "--annotation-file", "foobar/annotation.json", "--config", foobar.FileConfigName).
MatchStatus(statusKeys, true, 1).
WithWorkDir(tempDir).Exec()

// validate
// see testdata\files\foobar\annotation.json
fetched := ORAS("manifest", "fetch", RegistryRef(Host, repo, tag)).Exec().Out.Contents()
fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec().Out.Contents()
var manifest ocispec.Manifest
Expect(json.Unmarshal(fetched, &manifest)).ShouldNot(HaveOccurred())
Expect(manifest.Annotations["hi"]).To(Equal("manifest"))
Expand Down Expand Up @@ -316,7 +316,7 @@ var _ = Describe("OCI image layout users:", func() {
})

It("should push files with customized config file and mediatype", func() {
configType := "config.type"
configType := "config/type"
tempDir := PrepareTempFiles()
ref := LayoutRef(tempDir, tag)
ORAS("push", Flags.Layout, ref, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v").
Expand Down