From 651b347b97a2c8981c5f975a024572ee1a2e7807 Mon Sep 17 00:00:00 2001 From: Xiaoxuan Wang Date: Wed, 20 Mar 2024 08:43:39 +0000 Subject: [PATCH] added e2e Signed-off-by: Xiaoxuan Wang --- test/e2e/suite/command/blob.go | 8 ++++++++ test/e2e/suite/command/manifest.go | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/test/e2e/suite/command/blob.go b/test/e2e/suite/command/blob.go index 3ca5cfafa..717a7d366 100644 --- a/test/e2e/suite/command/blob.go +++ b/test/e2e/suite/command/blob.go @@ -45,6 +45,14 @@ var _ = Describe("ORAS beginners:", func() { ExpectFailure(). MatchErrKeyWords("Error: `-` read file from input and `--password-stdin` read password from input cannot be both used").Exec() }) + + It("should fail to read blob content and identity token from stdin at the same time", func() { + repo := fmt.Sprintf(repoFmt, "push", "password-stdin") + ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), "--identity-token-stdin", "-"). + ExpectFailure(). + MatchErrKeyWords("Error: `-` read file from input and `--identity-token-stdin` read identity token from input cannot be both used").Exec() + }) + It("should fail to push a blob from stdin but no blob size provided", func() { repo := fmt.Sprintf(repoFmt, "push", "no-size") ORAS("blob", "push", RegistryRef(ZOTHost, repo, pushDigest), "-"). diff --git a/test/e2e/suite/command/manifest.go b/test/e2e/suite/command/manifest.go index f7e52ad01..835a22a10 100644 --- a/test/e2e/suite/command/manifest.go +++ b/test/e2e/suite/command/manifest.go @@ -71,12 +71,19 @@ var _ = Describe("ORAS beginners:", func() { gomega.Expect(err).Should(gbytes.Say(`Run "oras manifest push -h"`)) }) - It("should fail pushing with a manifest from stdin without media type flag", func() { + It("should fail pushing with a manifest from stdin with password read from stdin", func() { tag := "from-stdin" ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), "-", "--password-stdin", "--media-type", "application/vnd.oci.image.manifest.v1+json"). ExpectFailure(). MatchErrKeyWords("`-`", "`--password-stdin`", " cannot be both used").Exec() }) + + It("should fail pushing with a manifest from stdin with identity token read from stdin", func() { + tag := "from-stdin" + ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), "-", "--identity-token-stdin", "--media-type", "application/vnd.oci.image.manifest.v1+json"). + ExpectFailure(). + MatchErrKeyWords("`-`", "`--identity-token-stdin`", " cannot be both used").Exec() + }) }) When("running `manifest fetch`", func() {