Skip to content

Commit

Permalink
test: improve coverage for resolve
Browse files Browse the repository at this point in the history
Signed-off-by: Sajay Antony <sajaya@microsoft.com>
  • Loading branch information
sajayantony committed Nov 15, 2023
1 parent a7d5577 commit 15a6c5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/e2e/internal/utils/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
BlobRepo = "command/blobs"
ArtifactRepo = "command/artifacts"
Namespace = "command"
InvalidRepo = "INVALID"
// env
RegHostKey = "ORAS_REGISTRY_HOST"
FallbackRegHostKey = "ORAS_REGISTRY_FALLBACK_HOST"
Expand Down
7 changes: 6 additions & 1 deletion test/e2e/suite/command/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ var _ = Describe("ORAS beginners:", func() {
It("should fail when no manifest reference provided", func() {
ORAS("resolve").ExpectFailure().MatchErrKeyWords("Error:").Exec()
})
It("should fail when when repo is invalid", func() {
ORAS("resolve", fmt.Sprintf("%s/%s", ZOTHost, InvalidRepo)).ExpectFailure().MatchErrKeyWords("Error:", fmt.Sprintf("invalid reference: invalid repository %q", InvalidRepo)).Exec()
})
It("should fail when no tag or digest provided", func() {
ORAS("resolve", RegistryRef(ZOTHost, ImageRepo, "")).ExpectFailure().MatchErrKeyWords("Error:", "no tag or digest when expecting <name:tag|name@digest>").Exec()
})
It("should fail when provided manifest reference is not found", func() {
ORAS("resolve", RegistryRef(ZOTHost, ImageRepo, "i-dont-think-this-tag-exists")).ExpectFailure().MatchErrKeyWords("Error: failed to resolve digest:", "not found").Exec()
})
Expand All @@ -39,7 +45,6 @@ var _ = Describe("ORAS beginners:", func() {
outString := string(out.Contents())
outString = strings.TrimSpace(outString)
gomega.Expect(outString).To(gomega.Equal(multi_arch.Digest))

})
It("should resolve with with the fully qualified reference", func() {
out := ORAS("resolve", "-l", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag)).Exec().Out
Expand Down

0 comments on commit 15a6c5f

Please sign in to comment.