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 repo specs to ZOT #1088

Merged
merged 37 commits into from
Aug 30, 2023
Merged
Changes from all commits
Commits
Show all changes
37 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
f028e61
fix e2e
qweeah Aug 28, 2023
a25d23f
fix e2e
qweeah Aug 29, 2023
003072a
Merge branch 'zot-push' into zot-pull
qweeah Aug 29, 2023
df78bef
test(e2e): migrate specs for `oras pull`
qweeah Aug 29, 2023
1e9bbd8
fix e2e
qweeah Aug 29, 2023
e2a4c38
Merge branch 'zot-push' into zot-pull
qweeah Aug 29, 2023
003c2c9
test(e2e): migrate `oras tag` specs to ZOT
qweeah Aug 29, 2023
e654e06
test(e2e): migrate `oras tag` specs to ZOT
qweeah Aug 29, 2023
d57f9bc
test(e2e): migrate `oras repo` specs to ZOT
qweeah Aug 29, 2023
0c7187c
remove focus
qweeah Aug 29, 2023
b42c474
Merge remote-tracking branch 'origin_src/main' into zot-blob
qweeah Aug 29, 2023
1f18415
test(e2e): migrate `oras repo` specs to ZOT
qweeah Aug 29, 2023
670ac47
Merge branch 'zot-blob' into zot-repo
qweeah Aug 29, 2023
a215817
Merge remote-tracking branch 'origin_src/main' into zot-repo
qweeah Aug 30, 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
70 changes: 33 additions & 37 deletions test/e2e/suite/command/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("ORAS beginners:", func() {

It("should fail listing repositories if wrong registry provided", func() {
ORAS("repo", "ls").ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("repo", "ls", RegistryRef(Host, ImageRepo, "some-tag")).ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("repo", "ls", RegistryRef(ZOTHost, ImageRepo, "some-tag")).ExpectFailure().MatchErrKeyWords("Error:").Exec()
})
})
When("running `repo tags`", func() {
Expand All @@ -57,8 +57,8 @@ var _ = Describe("ORAS beginners:", func() {

It("should fail listing repositories if wrong registry provided", func() {
ORAS("repo", "tags").ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("repo", "tags", Host).ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("repo", "tags", RegistryRef(Host, ImageRepo, "some-tag")).ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("repo", "tags", ZOTHost).ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("repo", "tags", RegistryRef(ZOTHost, ImageRepo, "some-tag")).ExpectFailure().MatchErrKeyWords("Error:").Exec()
})
})
})
Expand All @@ -67,110 +67,106 @@ var _ = Describe("ORAS beginners:", func() {
var _ = Describe("1.1 registry users:", func() {
When("running `repo ls`", func() {
It("should list repositories", func() {
ORAS("repository", "list", Host).MatchKeyWords(ImageRepo).Exec()
ORAS("repository", "list", ZOTHost).MatchKeyWords(ImageRepo).Exec()
})
It("should list repositories under provided namespace", func() {
ORAS("repo", "ls", RegistryRef(Host, Namespace, "")).MatchKeyWords(ImageRepo[len(Namespace)+1:]).Exec()
ORAS("repo", "ls", RegistryRef(ZOTHost, Namespace, "")).MatchKeyWords(ImageRepo[len(Namespace)+1:]).Exec()
})

It("should not list repositories without a fully matched namespace", func() {
repo := "command-draft/images"
ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, repo, foobar.Tag)).
ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, repo, foobar.Tag)).
WithDescription("prepare destination repo: " + repo).
Exec()
ORAS("repo", "ls", Host).MatchKeyWords(ImageRepo, repo).Exec()
session := ORAS("repo", "ls", RegistryRef(Host, Namespace, "")).MatchKeyWords(ImageRepo[len(Namespace)+1:]).Exec()
ORAS("repo", "ls", ZOTHost).MatchKeyWords(ImageRepo, repo).Exec()
session := ORAS("repo", "ls", RegistryRef(ZOTHost, Namespace, "")).MatchKeyWords(ImageRepo[len(Namespace)+1:]).Exec()
Expect(session.Out).ShouldNot(gbytes.Say(repo[len(Namespace)+1:]))
})

It("should list repositories via short command", func() {
ORAS("repo", "ls", Host).MatchKeyWords(ImageRepo).Exec()
})
It("should list partial repositories via `last` flag", func() {
session := ORAS("repo", "ls", Host, "--last", ImageRepo).Exec()
repoRegex := regexp.QuoteMeta(ImageRepo + "\n")
Expect(session.Out).ShouldNot(gbytes.Say(repoRegex))
ORAS("repo", "ls", ZOTHost).MatchKeyWords(ImageRepo).Exec()
})

})
When("running `repo tags`", func() {
repoWithName := func(name string) string {
return fmt.Sprintf("command/images/repo/tags/%d/%s", GinkgoRandomSeed(), name)
}
repoRef := RegistryRef(Host, ImageRepo, "")
repoRef := RegistryRef(ZOTHost, ImageRepo, "")
It("should list tags", func() {
ORAS("repository", "show-tags", repoRef).MatchKeyWords(multi_arch.Tag, foobar.Tag).Exec()
})
It("should list tags via short command", func() {
ORAS("repo", "tags", repoRef).MatchKeyWords(multi_arch.Tag, foobar.Tag).Exec()

})
It("should list partial tags via `last` flag", func() {
session := ORAS("repo", "tags", repoRef, "--last", foobar.Tag).MatchKeyWords(multi_arch.Tag).Exec()
Expect(session.Out).ShouldNot(gbytes.Say(foobar.Tag))
})

It("Should list out tags associated to the provided reference", func() {
// prepare
repo := repoWithName("filter-tag")
tags := []string{foobar.Tag, "bax", "bay", "baz"}
refWithTags := fmt.Sprintf("%s:%s", RegistryRef(Host, repo, ""), strings.Join(tags, ","))
ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Tag), refWithTags).
refWithTags := fmt.Sprintf("%s:%s", RegistryRef(ZOTHost, repo, ""), strings.Join(tags, ","))
ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), refWithTags).
WithDescription("prepare: copy and create multiple tags to " + refWithTags).
Exec()
ORAS("cp", RegistryRef(Host, ImageRepo, multi_arch.Tag), RegistryRef(Host, ImageRepo, "")).
ORAS("cp", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), RegistryRef(ZOTHost, ImageRepo, "")).
WithDescription("prepare: copy tag with different digest").
Exec()
// test
viaTag := ORAS("repo", "tags", "-v", RegistryRef(Host, repo, foobar.Tag)).
viaTag := ORAS("repo", "tags", "-v", RegistryRef(ZOTHost, repo, foobar.Tag)).
MatchKeyWords(tags...).
MatchErrKeyWords(feature.Experimental.Mark, foobar.Digest).Exec().Out
Expect(viaTag).ShouldNot(gbytes.Say(multi_arch.Tag))

viaDigest := ORAS("repo", "tags", "-v", RegistryRef(Host, repo, foobar.Digest)).
viaDigest := ORAS("repo", "tags", "-v", RegistryRef(ZOTHost, repo, foobar.Digest)).
MatchKeyWords(tags...).
MatchErrKeyWords(feature.Experimental.Mark, foobar.Digest).Exec().Out
Expect(viaDigest).ShouldNot(gbytes.Say(multi_arch.Tag))
})
})
})

var _ = Describe("1.0 registry users:", func() {
When("running `repo ls`", func() {
It("should list partial repositories via `last` flag", func() {
session := ORAS("repo", "ls", FallbackHost, "--last", ArtifactRepo).Exec()
repoRegex := regexp.QuoteMeta(ImageRepo + "\n")
Expect(session.Out).ShouldNot(gbytes.Say(repoRegex))
})
})
})

var _ = Describe("OCI image layout users:", func() {
When("running `repo tags`", func() {
prepare := func(srcRef, repoRoot string, tags ...string) {
ORAS("cp", srcRef, LayoutRef(repoRoot, strings.Join(tags, ",")), Flags.ToLayout).
prepare := func(repo string, fromTag string, toTags ...string) string {
root := PrepareTempOCI(repo)
ORAS("tag", LayoutRef(root, fromTag), strings.Join(toTags, " "), Flags.Layout).
WithDescription("prepare in OCI layout").
Exec()
return root
}
foobarImageRef := RegistryRef(Host, ImageRepo, foobar.Tag)
multiImageRef := RegistryRef(Host, ImageRepo, multi_arch.Tag)
tagOutput := foobar.Tag + "\n"
It("should list tags", func() {
root := GinkgoT().TempDir()
prepare(foobarImageRef, root, foobar.Tag)
root := PrepareTempOCI(ImageRepo)
ORAS("repository", "show-tags", root, Flags.Layout).MatchKeyWords(tagOutput).Exec()
})
It("should list tags via short command", func() {
root := GinkgoT().TempDir()
prepare(foobarImageRef, root, foobar.Tag)
root := PrepareTempOCI(ImageRepo)
ORAS("repository", "tags", root, Flags.Layout).MatchKeyWords(tagOutput).Exec()
})
It("should list partial tags via `last` flag", func() {
// prepare
root := GinkgoT().TempDir()
extra := "zzz"
prepare(foobarImageRef, root, foobar.Tag, extra)
root := prepare(ImageRepo, foobar.Tag, extra)
// test
session := ORAS("repository", "tags", root, "--last", foobar.Tag, Flags.Layout).MatchKeyWords(extra).Exec()
Expect(session.Out).ShouldNot(gbytes.Say(regexp.QuoteMeta(tagOutput)))
})

It("should list out tags associated to the provided reference", func() {
// prepare
root := GinkgoT().TempDir()
tags := []string{foobar.Tag, "bax", "bay", "baz"}
prepare(foobarImageRef, root, tags...)
prepare(multiImageRef, root, multi_arch.Tag)
root := prepare(ImageRepo, foobar.Tag, tags...)
// test
viaTag := ORAS("repo", "tags", "-v", LayoutRef(root, foobar.Tag), Flags.Layout).
WithDescription("via tag").
Expand Down
Loading