diff --git a/test/e2e/suite/command/manifest.go b/test/e2e/suite/command/manifest.go index 44d8f4ff0..475301712 100644 --- a/test/e2e/suite/command/manifest.go +++ b/test/e2e/suite/command/manifest.go @@ -72,7 +72,7 @@ var _ = Describe("ORAS beginners:", func() { It("should fail pushing with a manifest from stdin without media type flag", func() { tag := "from-stdin" - ORAS("manifest", "push", RegistryRef(Host, ImageRepo, tag), "-", "--password-stdin", "--media-type", "application/vnd.oci.image.manifest.v1+json"). + 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() }) @@ -100,20 +100,20 @@ var _ = Describe("ORAS beginners:", func() { tempTag := "to-delete" It("should cancel deletion without confirmation", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "no-confirm") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag)) - ORAS("manifest", "delete", RegistryRef(Host, dstRepo, tempTag)). + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, tempTag)) + ORAS("manifest", "delete", RegistryRef(ZOTHost, dstRepo, tempTag)). MatchKeyWords("Operation cancelled.", "Are you sure you want to delete the manifest ", " and all tags associated with it?").Exec() - validateTag(RegistryRef(Host, dstRepo, ""), tempTag, false) + validateTag(RegistryRef(ZOTHost, dstRepo, ""), tempTag, false) }) It("should fail if descriptor flag is provided without confirmation flag", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "descriptor-without-confirm") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag)) - ORAS("manifest", "delete", RegistryRef(Host, dstRepo, tempTag), "--descriptor").ExpectFailure().Exec() + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, tempTag)) + ORAS("manifest", "delete", RegistryRef(ZOTHost, dstRepo, tempTag), "--descriptor").ExpectFailure().Exec() }) It("should fail to delete a non-existent manifest via digest without force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, invalidDigest) + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, invalidDigest) ORAS("manifest", "delete", toDeleteRef). ExpectFailure(). MatchErrKeyWords(toDeleteRef, "the specified manifest does not exist"). @@ -121,7 +121,7 @@ var _ = Describe("ORAS beginners:", func() { }) It("should fail to delete a non-existent manifest and output descriptor via digest, with force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, invalidDigest) + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, invalidDigest) ORAS("manifest", "delete", toDeleteRef, "--force", "--descriptor"). ExpectFailure(). MatchErrKeyWords(toDeleteRef, "the specified manifest does not exist"). @@ -129,7 +129,7 @@ var _ = Describe("ORAS beginners:", func() { }) It("should fail to delete a non-existent manifest and output descriptor via tag, without force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, "this.tag.should-not.be-existed") + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, "this.tag.should-not.be-existed") ORAS("manifest", "delete", toDeleteRef, "--force", "--descriptor"). ExpectFailure(). MatchErrKeyWords(toDeleteRef, "the specified manifest does not exist"). @@ -138,14 +138,14 @@ var _ = Describe("ORAS beginners:", func() { It("should fail if no manifest reference provided", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "no-reference") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag)) + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, tempTag)) ORAS("manifest", "delete").ExpectFailure().Exec() }) It("should fail if no digest provided", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "no-reference") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, "")) - ORAS("manifest", "delete", RegistryRef(Host, dstRepo, "")).ExpectFailure().MatchErrKeyWords("name@digest").Exec() + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, "")) + ORAS("manifest", "delete", RegistryRef(ZOTHost, dstRepo, "")).ExpectFailure().MatchErrKeyWords("name@digest").Exec() }) }) When("running `manifest fetch-config`", func() { @@ -159,10 +159,10 @@ var _ = Describe("ORAS beginners:", func() { }) It("should fail if provided reference does not exist", func() { - ORAS("manifest", "fetch-config", RegistryRef(Host, ImageRepo, "this-tag-should-not-exist")).ExpectFailure().Exec() + ORAS("manifest", "fetch-config", RegistryRef(ZOTHost, ImageRepo, "this-tag-should-not-exist")).ExpectFailure().Exec() }) It("should fail fetching a config of non-image manifest type", func() { - ORAS("manifest", "fetch-config", RegistryRef(Host, ImageRepo, multi_arch.Tag)).ExpectFailure().Exec() + ORAS("manifest", "fetch-config", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag)).ExpectFailure().Exec() }) }) }) @@ -172,108 +172,103 @@ var _ = Describe("1.1 registry users:", func() { repoFmt := fmt.Sprintf("command/manifest/%%s/%d/%%s", GinkgoRandomSeed()) When("running `manifest fetch`", func() { It("should fetch manifest list with digest", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest)). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest)). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch manifest list with tag", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag)). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag)). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch manifest list to stdout", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--output", "-"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--output", "-"). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch manifest to file and output descriptor to stdout", func() { fetchPath := filepath.Join(GinkgoT().TempDir(), "fetchedImage") - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--output", fetchPath, "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--output", fetchPath, "--descriptor"). MatchContent(multi_arch.Descriptor).Exec() MatchFile(fetchPath, multi_arch.Manifest, DefaultTimeout) }) It("should fetch manifest via tag with platform selection", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch manifest via digest with platform selection", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch manifest with platform validation", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch descriptor via digest", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--descriptor"). MatchContent(multi_arch.Descriptor).Exec() }) It("should fetch descriptor via digest with platform selection", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() }) It("should fetch descriptor via digest with platform validation", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--descriptor"). MatchContent(multi_arch.LinuxAMD64DescStr).Exec() }) It("should fetch descriptor via tag", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--descriptor"). MatchContent(multi_arch.Descriptor).Exec() }) It("should fetch descriptor via tag with platform selection", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() }) It("should fetch index content with media type assertion", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--media-type", "application/vnd.oci.image.index.v1+json"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--media-type", "application/vnd.oci.image.index.v1+json"). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch index descriptor with media type assertion", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--media-type", "application/vnd.oci.image.index.v1+json", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--media-type", "application/vnd.oci.image.index.v1+json", "--descriptor"). MatchContent(multi_arch.Descriptor).Exec() }) It("should fetch image content with media type assertion and platform selection", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() }) It("should fetch image descriptor with media type assertion and platform selection", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.Digest), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.index.v1+json,application/vnd.oci.image.manifest.v1+json", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() }) It("should fetch image content with media type assertion and platform validation", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.manifest.v1+json"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.manifest.v1+json"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch image descriptor with media type assertion and platform validation", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.manifest.v1+json", "--descriptor"). + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--media-type", "application/vnd.oci.image.manifest.v1+json", "--descriptor"). MatchContent(multi_arch.LinuxAMD64DescStr).Exec() }) - It("should fail to fetch image if media type assertion fails", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--media-type", "this.will.not.be.found"). - ExpectFailure(). - MatchErrKeyWords(multi_arch.LinuxAMD64.Digest.String(), "error: ", "not found").Exec() - }) It("should fail if no manifest tag or digest is provided", func() { - ORAS("manifest", "fetch", RegistryRef(Host, ImageRepo, "")).ExpectFailure().MatchErrKeyWords("Error:", "invalid image reference").Exec() + ORAS("manifest", "fetch", RegistryRef(ZOTHost, ImageRepo, "")).ExpectFailure().MatchErrKeyWords("Error:", "invalid image reference").Exec() }) }) @@ -284,14 +279,14 @@ var _ = Describe("1.1 registry users:", func() { It("should push a manifest from stdin without media type flag", func() { tag := "from-stdin" - ORAS("manifest", "push", RegistryRef(Host, ImageRepo, tag), "-"). - MatchKeyWords("Pushed", RegistryRef(Host, ImageRepo, tag), "Digest:", digest). + ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), "-"). + MatchKeyWords("Pushed", RegistryRef(ZOTHost, ImageRepo, tag), "Digest:", digest). WithInput(strings.NewReader(manifest)).Exec() }) It("should push a manifest and output descriptor", func() { tag := "from-stdin" - ORAS("manifest", "push", RegistryRef(Host, ImageRepo, tag), "-", "--descriptor"). + ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), "-", "--descriptor"). MatchContent(descriptor). WithInput(strings.NewReader(manifest)).Exec() }) @@ -299,58 +294,44 @@ var _ = Describe("1.1 registry users:", func() { It("should push a manifest from file", func() { manifestPath := WriteTempFile("manifest.json", manifest) tag := "from-file" - ORAS("manifest", "push", RegistryRef(Host, ImageRepo, tag), manifestPath, "--media-type", "application/vnd.oci.image.manifest.v1+json"). - MatchKeyWords("Pushed", RegistryRef(Host, ImageRepo, tag), "Digest:", digest). - WithInput(strings.NewReader(manifest)).Exec() - }) - - It("should push a manifest from stdin with media type flag", func() { - manifest := `{"schemaVersion":2,"config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53}}` - digest := "sha256:0c2ae2c73c5dde0a42582d328b2e2ea43f36ba20f604fa8706f441ac8b0a3445" - tag := "mediatype-flag" - ORAS("manifest", "push", RegistryRef(Host, ImageRepo, tag), "-", "--media-type", "application/vnd.oci.image.manifest.v1+json"). - MatchKeyWords("Pushed", RegistryRef(Host, ImageRepo, tag), "Digest:", digest). + ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), manifestPath, "--media-type", "application/vnd.oci.image.manifest.v1+json"). + MatchKeyWords("Pushed", RegistryRef(ZOTHost, ImageRepo, tag), "Digest:", digest). WithInput(strings.NewReader(manifest)).Exec() - - ORAS("manifest", "push", RegistryRef(Host, ImageRepo, ""), "-"). - WithInput(strings.NewReader(manifest)). - ExpectFailure(). - WithDescription("fail if no media type flag provided").Exec() }) }) When("running `manifest fetch-config`", func() { It("should fetch a config via a tag", func() { - ORAS("manifest", "fetch-config", RegistryRef(Host, ImageRepo, foobar.Tag)). + ORAS("manifest", "fetch-config", RegistryRef(ZOTHost, ImageRepo, foobar.Tag)). MatchContent("{}").Exec() }) It("should fetch a config descriptor via a tag", func() { - ORAS("manifest", "fetch-config", "--descriptor", RegistryRef(Host, ImageRepo, foobar.Tag)). + ORAS("manifest", "fetch-config", "--descriptor", RegistryRef(ZOTHost, ImageRepo, foobar.Tag)). MatchContent(foobar.ImageConfigDesc).Exec() }) It("should fetch a config via digest", func() { - ORAS("manifest", "fetch-config", RegistryRef(Host, ImageRepo, foobar.Tag)). + ORAS("manifest", "fetch-config", RegistryRef(ZOTHost, ImageRepo, foobar.Tag)). MatchContent("{}").Exec() }) It("should fetch a config descriptor via a digest", func() { - ORAS("manifest", "fetch-config", "--descriptor", RegistryRef(Host, ImageRepo, foobar.Digest)). + ORAS("manifest", "fetch-config", "--descriptor", RegistryRef(ZOTHost, ImageRepo, foobar.Digest)). MatchContent(foobar.ImageConfigDesc).Exec() }) It("should fetch a config of a specific platform", func() { - ORAS("manifest", "fetch-config", "--platform", "linux/amd64", RegistryRef(Host, ImageRepo, multi_arch.Tag)). + ORAS("manifest", "fetch-config", "--platform", "linux/amd64", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag)). MatchContent(multi_arch.LinuxAMD64Config).Exec() }) It("should fetch a config descriptor of a specific platform", func() { - ORAS("manifest", "fetch-config", "--descriptor", "--platform", "linux/amd64", RegistryRef(Host, ImageRepo, multi_arch.Tag)). + ORAS("manifest", "fetch-config", "--descriptor", "--platform", "linux/amd64", RegistryRef(ZOTHost, ImageRepo, multi_arch.Tag)). MatchContent(multi_arch.LinuxAMD64ConfigDesc).Exec() }) It("should fail if no manifest tag or digest is provided", func() { - ORAS("manifest", "fetch-config", RegistryRef(Host, ImageRepo, "")).ExpectFailure().MatchErrKeyWords("Error:", "invalid image reference").Exec() + ORAS("manifest", "fetch-config", RegistryRef(ZOTHost, ImageRepo, "")).ExpectFailure().MatchErrKeyWords("Error:", "invalid image reference").Exec() }) }) @@ -358,30 +339,30 @@ var _ = Describe("1.1 registry users:", func() { tempTag := "to-delete" It("should do confirmed deletion via input", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "confirm-input") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag)) - ORAS("manifest", "delete", RegistryRef(Host, dstRepo, tempTag)). + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, tempTag)) + ORAS("manifest", "delete", RegistryRef(ZOTHost, dstRepo, tempTag)). WithInput(strings.NewReader("y")).Exec() - validateTag(RegistryRef(Host, dstRepo, ""), tempTag, true) + validateTag(RegistryRef(ZOTHost, dstRepo, ""), tempTag, true) }) It("should do confirmed deletion via flag", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "confirm-flag") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag)) - ORAS("manifest", "delete", RegistryRef(Host, dstRepo, tempTag), "-f").Exec() - validateTag(RegistryRef(Host, dstRepo, ""), tempTag, true) + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, tempTag)) + ORAS("manifest", "delete", RegistryRef(ZOTHost, dstRepo, tempTag), "-f").Exec() + validateTag(RegistryRef(ZOTHost, dstRepo, ""), tempTag, true) }) It("should do forced deletion and output descriptor", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "output-descriptor") - prepare(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, dstRepo, tempTag)) - ORAS("manifest", "delete", RegistryRef(Host, dstRepo, tempTag), "-f", "--descriptor"). + prepare(RegistryRef(ZOTHost, ImageRepo, foobar.Tag), RegistryRef(ZOTHost, dstRepo, tempTag)) + ORAS("manifest", "delete", RegistryRef(ZOTHost, dstRepo, tempTag), "-f", "--descriptor"). MatchContent("{\"mediaType\":\"application/vnd.oci.image.manifest.v1+json\",\"digest\":\"sha256:fd6ed2f36b5465244d5dc86cb4e7df0ab8a9d24adc57825099f522fe009a22bb\",\"size\":851}"). WithDescription("cancel without confirmation").Exec() - validateTag(RegistryRef(Host, dstRepo, ""), tempTag, true) + validateTag(RegistryRef(ZOTHost, dstRepo, ""), tempTag, true) }) It("should succeed when deleting a non-existent manifest with force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, invalidDigest) + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, invalidDigest) ORAS("manifest", "delete", toDeleteRef, "--force"). MatchKeyWords("Missing", toDeleteRef). Exec() @@ -391,84 +372,79 @@ var _ = Describe("1.1 registry users:", func() { var _ = Describe("OCI image layout users:", func() { When("running `manifest fetch`", func() { - prepare := func() string { - tmp := GinkgoT().TempDir() - ORAS("cp", RegistryRef(Host, ImageRepo, multi_arch.Digest), Flags.ToLayout, LayoutRef(tmp, multi_arch.Tag)).WithDescription("prepare image from registry to OCI layout").Exec() - return tmp - } It("should fetch manifest list with digest", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest)). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch manifest list with tag", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Tag)). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch manifest list to stdout", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Tag), "--output", "-"). MatchContent(multi_arch.Manifest).Exec() }) It("should fetch manifest to file and output descriptor to stdout", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) fetchPath := filepath.Join(GinkgoT().TempDir(), "fetchedImage") ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest), "--output", fetchPath, "--descriptor"). MatchContent(multi_arch.Descriptor).Exec() MatchFile(fetchPath, multi_arch.Manifest, DefaultTimeout) }) It("should fetch manifest via tag with platform selection", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Tag), "--platform", "linux/amd64"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch manifest via digest with platform selection", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest), "--platform", "linux/amd64"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch manifest with platform validation", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest), "--platform", "linux/amd64"). MatchContent(multi_arch.LinuxAMD64Manifest).Exec() }) It("should fetch descriptor via digest", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest), "--descriptor"). MatchContent(multi_arch.Descriptor).Exec() }) It("should fetch descriptor via digest with platform selection", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest), "--platform", "linux/amd64", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() }) It("should fetch descriptor via digest with platform validation", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.LinuxAMD64.Digest.String()), "--platform", "linux/amd64", "--descriptor"). MatchContent(multi_arch.LinuxAMD64DescStr).Exec() }) It("should fetch descriptor via tag", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Tag), "--descriptor"). MatchContent(multi_arch.AnnotatedDescriptor).Exec() }) It("should fetch descriptor via tag with platform selection", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Tag), "--platform", "linux/amd64", "--descriptor"). MatchContent(multi_arch.LinuxAMD64IndexDesc).Exec() }) It("should fail to fetch image if media type assertion is used", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, LayoutRef(root, multi_arch.Digest), "--media-type", "application/vnd.oci.image.manifest.v1+json"). ExpectFailure(). MatchErrKeyWords("Error", "--media-type", "--oci-layout").Exec() }) It("should fail if no manifest tag or digest is provided", func() { - root := prepare() + root := PrepareTempOCI(ImageRepo) ORAS("manifest", "fetch", Flags.Layout, root).ExpectFailure(). MatchErrKeyWords("Error:", "invalid image reference").Exec() }) @@ -478,7 +454,7 @@ var _ = Describe("OCI image layout users:", func() { prepare := func(tag string) string { tmpRoot := GinkgoT().TempDir() cpPath := tmpRoot - from := RegistryRef(Host, ImageRepo, tag) + from := RegistryRef(ZOTHost, ImageRepo, tag) cpPath = fmt.Sprintf("%s:%s", tmpRoot, tag) ORAS("cp", from, Flags.ToLayout, cpPath).WithDescription("prepare image from registry to OCI layout").Exec() return tmpRoot @@ -520,6 +496,35 @@ var _ = Describe("OCI image layout users:", func() { }) }) +var _ = Describe("1.0 registry users:", func() { + When("running `manifest fetch`", func() { + It("should fail to fetch image if media type assertion fails", func() { + ORAS("manifest", "fetch", RegistryRef(FallbackHost, ImageRepo, multi_arch.LinuxAMD64.Digest.String()), "--media-type", "this.will.not.be.found"). + ExpectFailure(). + MatchErrKeyWords(multi_arch.LinuxAMD64.Digest.String(), "error: ", "not found").Exec() + }) + }) + + When("running `manifest push`", func() { + repoFmt := fmt.Sprintf("command/manifest/%%s/%d/%%s", GinkgoRandomSeed()) + It("should push a manifest from stdin with media type flag", func() { + dstRepo := fmt.Sprintf(repoFmt, "push", "no-media-type") + manifest := `{"schemaVersion":2,"config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a","size":53}}` + digest := "sha256:ed83217a266b93461f3d98c4184ddeacf5991482752c3bafd2a4170a58028e91" + tag := "mediatype-flag" + // prepare + ORAS("cp", RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag), RegistryRef(FallbackHost, dstRepo, foobar.Tag)).Exec() + ORAS("manifest", "push", RegistryRef(FallbackHost, dstRepo, tag), "-", "--media-type", "application/vnd.oci.image.manifest.v1+json"). + MatchKeyWords("Pushed", RegistryRef(FallbackHost, dstRepo, tag), "Digest:", digest). + WithInput(strings.NewReader(manifest)).Exec() + + ORAS("manifest", "push", RegistryRef(FallbackHost, dstRepo, ""), "-"). + WithInput(strings.NewReader(manifest)). + ExpectFailure(). + WithDescription("fail if no media type flag provided").Exec() + }) + }) +}) var _ = Describe("OCI image layout users:", func() { When("running `manifest push`", func() { scratchSize := 2