diff --git a/.gitignore b/.gitignore index cb04bf2f0..163bf6ab3 100644 --- a/.gitignore +++ b/.gitignore @@ -54,5 +54,6 @@ test/e2e/testdata/distribution/mount_fallback/docker/ # OCI Layout Files ZOT storage files for local E2E testing test/e2e/testdata/zot/ !test/e2e/testdata/zot/command/images +!test/e2e/testdata/zot/command/blobs !test/e2e/testdata/zot/config.json !test/e2e/testdata/zot/passwd_bcrypt \ No newline at end of file diff --git a/test/e2e/internal/utils/prepare.go b/test/e2e/internal/utils/prepare.go index 3416e6641..5d92fc347 100644 --- a/test/e2e/internal/utils/prepare.go +++ b/test/e2e/internal/utils/prepare.go @@ -28,8 +28,8 @@ import ( "github.com/onsi/gomega/gbytes" ) -// CopyZotRepo copies oci layout data between repostories. -func CopyZotRepo(fromRepo string, toRepo string) { +// CopyZOTRepo copies oci layout data between repostories. +func CopyZOTRepo(fromRepo string, toRepo string) { zotRoot := filepath.Join(TestDataRoot, "zot") fromRepo = filepath.Join(zotRoot, fromRepo) toRepo = filepath.Join(zotRoot, toRepo) diff --git a/test/e2e/internal/utils/testdata.go b/test/e2e/internal/utils/testdata.go index c29cce1f8..b4aab0f84 100644 --- a/test/e2e/internal/utils/testdata.go +++ b/test/e2e/internal/utils/testdata.go @@ -19,8 +19,8 @@ const ( PreviewDesc = "** This command is in preview and under development. **" ExampleDesc = "\nExample - " ImageRepo = "command/images" + BlobRepo = "command/blobs" ArtifactRepo = "command/artifacts" - Repo = "command/images" Namespace = "command" // env RegHostKey = "ORAS_REGISTRY_HOST" diff --git a/test/e2e/suite/command/attach.go b/test/e2e/suite/command/attach.go index d827b987c..0c813d9e7 100644 --- a/test/e2e/suite/command/attach.go +++ b/test/e2e/suite/command/attach.go @@ -71,7 +71,7 @@ var _ = Describe("1.1 registry users:", func() { When("running attach command", func() { It("should attach a file to a subject", func() { testRepo := attachTestRepo("simple") - CopyZotRepo(ImageRepo, testRepo) + CopyZOTRepo(ImageRepo, testRepo) subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia)). WithWorkDir(PrepareTempFiles()). @@ -84,7 +84,7 @@ var _ = Describe("1.1 registry users:", func() { tempDir := PrepareTempFiles() exportName := "manifest.json" subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) - CopyZotRepo(ImageRepo, testRepo) + CopyZOTRepo(ImageRepo, testRepo) // test ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia), "--export-manifest", exportName). WithWorkDir(tempDir). @@ -102,7 +102,7 @@ var _ = Describe("1.1 registry users:", func() { testRepo := attachTestRepo("image") tempDir := PrepareTempFiles() subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) - CopyZotRepo(ImageRepo, testRepo) + CopyZOTRepo(ImageRepo, testRepo) // test ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia)). WithWorkDir(tempDir). @@ -120,7 +120,7 @@ var _ = Describe("1.1 registry users:", func() { absAttachFileName := filepath.Join(PrepareTempFiles(), foobar.AttachFileName) subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) - CopyZotRepo(ImageRepo, testRepo) + CopyZOTRepo(ImageRepo, testRepo) statusKey := foobar.AttachFileStateKey statusKey.Name = absAttachFileName ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", absAttachFileName, foobar.AttachFileMedia), "--disable-path-validation"). @@ -133,7 +133,7 @@ var _ = Describe("1.1 registry users:", func() { absAttachFileName := filepath.Join(PrepareTempFiles(), foobar.AttachFileName) subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) - CopyZotRepo(ImageRepo, testRepo) + CopyZOTRepo(ImageRepo, testRepo) statusKey := foobar.AttachFileStateKey statusKey.Name = absAttachFileName ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", absAttachFileName, foobar.AttachFileMedia)). diff --git a/test/e2e/suite/command/blob.go b/test/e2e/suite/command/blob.go index abf1d0a83..1eceee148 100644 --- a/test/e2e/suite/command/blob.go +++ b/test/e2e/suite/command/blob.go @@ -39,28 +39,30 @@ var _ = Describe("ORAS beginners:", func() { When("running `blob push`", func() { It("should fail to read blob content and password from stdin at the same time", func() { repo := fmt.Sprintf(repoFmt, "push", "password-stdin") - ORAS("blob", "push", RegistryRef(Host, repo, ""), "--password-stdin", "-"). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), "--password-stdin", "-"). ExpectFailure(). MatchErrKeyWords("Error: `-` read file from input and `--password-stdin` read password 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(Host, repo, pushDigest), "-"). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, pushDigest), "-"). WithInput(strings.NewReader(pushContent)). ExpectFailure(). MatchErrKeyWords("Error: `--size` must be provided if the blob is read from stdin").Exec() }) It("should fail to push a blob from stdin if invalid blob size provided", func() { + content := "another-test" + digest := "sha256:c897eff15c4586525388034f8246346681cb48d75a619039c566c4939a18102e" repo := fmt.Sprintf(repoFmt, "push", "invalid-stdin-size") - ORAS("blob", "push", RegistryRef(Host, repo, pushDigest), "-", "--size", "3"). - WithInput(strings.NewReader(pushContent)).ExpectFailure(). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, digest), "-", "--size", "3"). + WithInput(strings.NewReader(content)).ExpectFailure(). Exec() }) It("should fail to push a blob from stdin if invalid digest provided", func() { repo := fmt.Sprintf(repoFmt, "push", "invalid-stdin-digest") - ORAS("blob", "push", RegistryRef(Host, repo, invalidDigest), "-", "--size", strconv.Itoa(len(pushContent))). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, invalidDigest), "-", "--size", strconv.Itoa(len(pushContent))). WithInput(strings.NewReader(pushContent)).ExpectFailure(). Exec() }) @@ -68,7 +70,7 @@ var _ = Describe("ORAS beginners:", func() { It("should fail to push a blob from file if invalid blob size provided", func() { repo := fmt.Sprintf(repoFmt, "push", "invalid-file-digest") blobPath := WriteTempFile("blob", pushContent) - ORAS("blob", "push", RegistryRef(Host, repo, pushDigest), blobPath, "--size", "3"). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, pushDigest), blobPath, "--size", "3"). ExpectFailure(). Exec() }) @@ -76,7 +78,7 @@ var _ = Describe("ORAS beginners:", func() { It("should fail to push a blob from file if invalid digest provided", func() { repo := fmt.Sprintf(repoFmt, "push", "invalid-stdin-size") blobPath := WriteTempFile("blob", pushContent) - ORAS("blob", "push", RegistryRef(Host, repo, invalidDigest), blobPath, "--size", strconv.Itoa(len(pushContent))). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, invalidDigest), blobPath, "--size", strconv.Itoa(len(pushContent))). WithInput(strings.NewReader(pushContent)).ExpectFailure(). Exec() }) @@ -99,22 +101,22 @@ var _ = Describe("ORAS beginners:", func() { }) It("should fail if neither output path nor descriptor flag are not provided", func() { - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae")). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, "sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae")). ExpectFailure().Exec() }) It("should fail if no digest provided", func() { - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, "")). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, "")). ExpectFailure().Exec() }) It("should fail if provided digest doesn't existed", func() { - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, "sha256:2aaa2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a")). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, "sha256:2aaa2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a")). ExpectFailure().Exec() }) It("should fail if output path points to stdout and descriptor flag is provided", func() { - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, ""), "--descriptor", "--output", "-"). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, ""), "--descriptor", "--output", "-"). ExpectFailure().Exec() }) @@ -127,27 +129,27 @@ var _ = Describe("ORAS beginners:", func() { When("running `blob delete`", func() { It("should fail if no blob reference is provided", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "no-ref") - ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Digest), RegistryRef(Host, dstRepo, foobar.Digest)).Exec() + CopyZOTRepo(ImageRepo, dstRepo) ORAS("blob", "delete").ExpectFailure().Exec() - ORAS("blob", "fetch", RegistryRef(Host, dstRepo, foobar.FooBlobDigest), "--output", "-").MatchContent(foobar.FooBlobContent).Exec() + ORAS("blob", "fetch", RegistryRef(ZOTHost, dstRepo, foobar.FooBlobDigest), "--output", "-").MatchContent(foobar.FooBlobContent).Exec() }) It("should fail if no force flag and descriptor flag is provided", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "no-confirm") - ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Digest), RegistryRef(Host, dstRepo, foobar.Digest)).Exec() - ORAS("blob", "delete", RegistryRef(Host, dstRepo, foobar.FooBlobDigest), "--descriptor").ExpectFailure().Exec() - ORAS("blob", "fetch", RegistryRef(Host, dstRepo, foobar.FooBlobDigest), "--output", "-").MatchContent(foobar.FooBlobContent).Exec() + CopyZOTRepo(ImageRepo, dstRepo) + ORAS("blob", "delete", RegistryRef(ZOTHost, dstRepo, foobar.FooBlobDigest), "--descriptor").ExpectFailure().Exec() + ORAS("blob", "fetch", RegistryRef(ZOTHost, dstRepo, foobar.FooBlobDigest), "--output", "-").MatchContent(foobar.FooBlobContent).Exec() }) It("should fail if the blob reference is not in the form of ", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "wrong-ref-form") - ORAS("blob", "delete", fmt.Sprintf("%s/%s:%s", Host, dstRepo, "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), "--descriptor", "--force").ExpectFailure().Exec() - ORAS("blob", "delete", fmt.Sprintf("%s/%s:%s", Host, dstRepo, "test"), "--descriptor", "--force").ExpectFailure().Exec() - ORAS("blob", "delete", fmt.Sprintf("%s/%s@%s", Host, dstRepo, "test"), "--descriptor", "--force").ExpectFailure().Exec() + ORAS("blob", "delete", fmt.Sprintf("%s/%s:%s", ZOTHost, dstRepo, "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), "--descriptor", "--force").ExpectFailure().Exec() + ORAS("blob", "delete", fmt.Sprintf("%s/%s:%s", ZOTHost, dstRepo, "test"), "--descriptor", "--force").ExpectFailure().Exec() + ORAS("blob", "delete", fmt.Sprintf("%s/%s@%s", ZOTHost, dstRepo, "test"), "--descriptor", "--force").ExpectFailure().Exec() }) It("should fail to delete a non-existent blob without force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, invalidDigest) + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, invalidDigest) ORAS("blob", "delete", toDeleteRef). ExpectFailure(). MatchErrKeyWords(toDeleteRef, "the specified blob does not exist"). @@ -155,7 +157,7 @@ var _ = Describe("ORAS beginners:", func() { }) It("should fail to delete a non-existent blob and output descriptor, with force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, invalidDigest) + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, invalidDigest) ORAS("blob", "delete", toDeleteRef, "--force", "--descriptor"). ExpectFailure(). MatchErrKeyWords(toDeleteRef, "the specified blob does not exist"). @@ -169,28 +171,22 @@ var _ = Describe("1.1 registry users:", func() { When("running `blob delete`", func() { It("should delete a blob with interactive confirmation", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "prompt-confirmation") - ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Digest), RegistryRef(Host, dstRepo, foobar.Digest)).Exec() - toDeleteRef := RegistryRef(Host, dstRepo, foobar.FooBlobDigest) + CopyZOTRepo(BlobRepo, dstRepo) + toDeleteRef := RegistryRef(ZOTHost, dstRepo, foobar.FooBlobDigest) ORAS("blob", "delete", toDeleteRef). WithInput(strings.NewReader("y")). MatchKeyWords("Deleted", toDeleteRef).Exec() - ORAS("blob", "delete", toDeleteRef). - WithDescription("validate"). - WithInput(strings.NewReader("y")). - ExpectFailure(). - MatchErrKeyWords("Error:", toDeleteRef, "the specified blob does not exist").Exec() }) It("should delete a blob with force flag and output descriptor", func() { dstRepo := fmt.Sprintf(repoFmt, "delete", "flag-confirmation") - ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Digest), RegistryRef(Host, dstRepo, foobar.Digest)).Exec() - toDeleteRef := RegistryRef(Host, dstRepo, foobar.FooBlobDigest) + CopyZOTRepo(BlobRepo, dstRepo) + toDeleteRef := RegistryRef(ZOTHost, dstRepo, foobar.FooBlobDigest) ORAS("blob", "delete", toDeleteRef, "--force", "--descriptor").MatchContent(foobar.FooBlobDescriptor).Exec() - ORAS("blob", "delete", toDeleteRef).WithDescription("validate").ExpectFailure().MatchErrKeyWords("Error:", toDeleteRef, "the specified blob does not exist").Exec() }) It("should return success when deleting a non-existent blob with force flag set", func() { - toDeleteRef := RegistryRef(Host, ImageRepo, invalidDigest) + toDeleteRef := RegistryRef(ZOTHost, ImageRepo, invalidDigest) ORAS("blob", "delete", toDeleteRef, "--force"). MatchKeyWords("Missing", toDeleteRef). Exec() @@ -201,11 +197,11 @@ var _ = Describe("1.1 registry users:", func() { mediaType := "test.media" repo := fmt.Sprintf(repoFmt, "push", "blob-file-media-type") blobPath := WriteTempFile("blob", pushContent) - ORAS("blob", "push", RegistryRef(Host, repo, ""), blobPath, "--media-type", mediaType, "--descriptor"). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), blobPath, "--media-type", mediaType, "--descriptor"). MatchContent(fmt.Sprintf(pushDescFmt, mediaType)).Exec() - ORAS("blob", "fetch", RegistryRef(Host, repo, pushDigest), "--output", "-").MatchContent(pushContent).Exec() + ORAS("blob", "fetch", RegistryRef(ZOTHost, repo, pushDigest), "--output", "-").MatchContent(pushContent).Exec() - ORAS("blob", "push", RegistryRef(Host, repo, ""), blobPath, "-v"). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), blobPath, "-v"). WithDescription("skip the pushing if the blob already exists in the target repo"). MatchKeyWords("Exists").Exec() }) @@ -213,49 +209,42 @@ var _ = Describe("1.1 registry users:", func() { It("should push a blob from a stdin and output the descriptor with specific media-type", func() { mediaType := "test.media" repo := fmt.Sprintf(repoFmt, "push", "blob-file-media-type") - ORAS("blob", "push", RegistryRef(Host, repo, pushDigest), "-", "--media-type", mediaType, "--descriptor", "--size", strconv.Itoa(len(pushContent))). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, pushDigest), "-", "--media-type", mediaType, "--descriptor", "--size", strconv.Itoa(len(pushContent))). WithInput(strings.NewReader(pushContent)). MatchContent(fmt.Sprintf(pushDescFmt, mediaType)).Exec() - ORAS("blob", "fetch", RegistryRef(Host, repo, pushDigest), "--output", "-").MatchContent(pushContent).Exec() + ORAS("blob", "fetch", RegistryRef(ZOTHost, repo, pushDigest), "--output", "-").MatchContent(pushContent).Exec() }) }) When("running `blob fetch`", func() { It("should fetch blob descriptor ", func() { - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, foobar.FooBlobDigest), "--descriptor"). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, foobar.FooBlobDigest), "--descriptor"). MatchContent(foobar.FooBlobDescriptor).Exec() }) It("should fetch blob content and output to stdout", func() { - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, foobar.FooBlobDigest), "--output", "-"). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, foobar.FooBlobDigest), "--output", "-"). MatchContent(foobar.FooBlobContent).Exec() }) It("should fetch blob content and output to a file", func() { tempDir := GinkgoT().TempDir() contentPath := filepath.Join(tempDir, "fetched") - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, foobar.FooBlobDigest), "--output", contentPath). + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, foobar.FooBlobDigest), "--output", contentPath). WithWorkDir(tempDir).Exec() MatchFile(contentPath, foobar.FooBlobContent, DefaultTimeout) }) It("should fetch blob descriptor and output content to a file", func() { - tempDir := GinkgoT().TempDir() - contentPath := filepath.Join(tempDir, "fetched") - ORAS("blob", "fetch", RegistryRef(Host, ImageRepo, foobar.FooBlobDigest), "--output", contentPath, "--descriptor"). - MatchContent(foobar.FooBlobDescriptor). - WithWorkDir(tempDir).Exec() + contentPath := filepath.Join(GinkgoT().TempDir(), "fetched") + ORAS("blob", "fetch", RegistryRef(ZOTHost, ImageRepo, foobar.FooBlobDigest), "--output", contentPath, "--descriptor"). + MatchContent(foobar.FooBlobDescriptor).Exec() MatchFile(contentPath, foobar.FooBlobContent, DefaultTimeout) }) }) }) var _ = Describe("OCI image layout users:", func() { - prepare := func(from string) string { - tmpRoot := GinkgoT().TempDir() - ORAS("cp", from, Flags.ToLayout, tmpRoot).WithDescription("prepare image from registry to OCI layout").Exec() - return tmpRoot - } When("running `blob delete`", func() { It("should not support deleting a blob", func() { - toDeleteRef := LayoutRef(prepare(RegistryRef(Host, ImageRepo, foobar.Tag)), foobar.FooBlobDigest) + toDeleteRef := LayoutRef(PrepareTempOCI(ImageRepo), foobar.FooBlobDigest) ORAS("blob", "delete", Flags.Layout, toDeleteRef). WithInput(strings.NewReader("y")). MatchErrKeyWords("Error:", "unknown flag", Flags.Layout). @@ -266,17 +255,17 @@ var _ = Describe("OCI image layout users:", func() { When("running `blob fetch`", func() { It("should fetch blob descriptor", func() { - root := prepare(RegistryRef(Host, ImageRepo, foobar.Tag)) + root := PrepareTempOCI(ImageRepo) ORAS("blob", "fetch", Flags.Layout, LayoutRef(root, foobar.FooBlobDigest), "--descriptor"). MatchContent(foobar.FooBlobDescriptor).Exec() }) It("should fetch blob content and output to stdout", func() { - root := prepare(RegistryRef(Host, ImageRepo, foobar.Tag)) + root := PrepareTempOCI(ImageRepo) ORAS("blob", "fetch", Flags.Layout, LayoutRef(root, foobar.FooBlobDigest), "--output", "-"). MatchContent(foobar.FooBlobContent).Exec() }) It("should fetch blob content and output to a file", func() { - root := prepare(RegistryRef(Host, ImageRepo, foobar.Tag)) + root := PrepareTempOCI(ImageRepo) tempDir := GinkgoT().TempDir() contentPath := filepath.Join(tempDir, "fetched") ORAS("blob", "fetch", Flags.Layout, LayoutRef(root, foobar.FooBlobDigest), "--output", contentPath). @@ -284,7 +273,7 @@ var _ = Describe("OCI image layout users:", func() { MatchFile(contentPath, foobar.FooBlobContent, DefaultTimeout) }) It("should fetch blob descriptor and output content to a file", func() { - root := prepare(RegistryRef(Host, ImageRepo, foobar.Tag)) + root := PrepareTempOCI(ImageRepo) tempDir := GinkgoT().TempDir() contentPath := filepath.Join(tempDir, "fetched") ORAS("blob", "fetch", Flags.Layout, LayoutRef(root, foobar.FooBlobDigest), "--output", contentPath, "--descriptor"). diff --git a/test/e2e/suite/command/discover.go b/test/e2e/suite/command/discover.go index 15d3ba771..5690f535c 100644 --- a/test/e2e/suite/command/discover.go +++ b/test/e2e/suite/command/discover.go @@ -61,7 +61,7 @@ var _ = Describe("ORAS beginners:", func() { }) It("should fail when no tag or digest found in provided subject reference", func() { - ORAS("discover", RegistryRef(Host, Repo, "")).ExpectFailure().MatchErrKeyWords("Error:", "invalid image reference").Exec() + ORAS("discover", RegistryRef(Host, ImageRepo, "")).ExpectFailure().MatchErrKeyWords("Error:", "invalid image reference").Exec() }) }) }) diff --git a/test/e2e/suite/command/repo.go b/test/e2e/suite/command/repo.go index 844c9f5f1..2176001d0 100644 --- a/test/e2e/suite/command/repo.go +++ b/test/e2e/suite/command/repo.go @@ -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, Repo, "some-tag")).ExpectFailure().MatchErrKeyWords("Error:").Exec() + ORAS("repo", "ls", RegistryRef(Host, ImageRepo, "some-tag")).ExpectFailure().MatchErrKeyWords("Error:").Exec() }) }) When("running `repo tags`", func() { @@ -70,16 +70,16 @@ var _ = Describe("1.1 registry users:", func() { ORAS("repository", "list", Host).MatchKeyWords(ImageRepo).Exec() }) It("should list repositories under provided namespace", func() { - ORAS("repo", "ls", RegistryRef(Host, Namespace, "")).MatchKeyWords(Repo[len(Namespace)+1:]).Exec() + ORAS("repo", "ls", RegistryRef(Host, 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, Repo, foobar.Tag), RegistryRef(Host, repo, foobar.Tag)). + ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, repo, foobar.Tag)). WithDescription("prepare destination repo: " + repo). Exec() - ORAS("repo", "ls", Host).MatchKeyWords(Repo, repo).Exec() - session := ORAS("repo", "ls", RegistryRef(Host, Namespace, "")).MatchKeyWords(Repo[len(Namespace)+1:]).Exec() + ORAS("repo", "ls", Host).MatchKeyWords(ImageRepo, repo).Exec() + session := ORAS("repo", "ls", RegistryRef(Host, Namespace, "")).MatchKeyWords(ImageRepo[len(Namespace)+1:]).Exec() Expect(session.Out).ShouldNot(gbytes.Say(repo[len(Namespace)+1:])) }) @@ -115,10 +115,10 @@ var _ = Describe("1.1 registry users:", func() { 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, Repo, foobar.Tag), refWithTags). + ORAS("cp", RegistryRef(Host, ImageRepo, foobar.Tag), refWithTags). WithDescription("prepare: copy and create multiple tags to " + refWithTags). Exec() - ORAS("cp", RegistryRef(Host, Repo, multi_arch.Tag), RegistryRef(Host, Repo, "")). + ORAS("cp", RegistryRef(Host, ImageRepo, multi_arch.Tag), RegistryRef(Host, ImageRepo, "")). WithDescription("prepare: copy tag with different digest"). Exec() // test diff --git a/test/e2e/testdata/zot/command/blobs/blobs/sha256/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae b/test/e2e/testdata/zot/command/blobs/blobs/sha256/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae new file mode 100644 index 000000000..191028156 --- /dev/null +++ b/test/e2e/testdata/zot/command/blobs/blobs/sha256/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae @@ -0,0 +1 @@ +foo \ No newline at end of file diff --git a/test/e2e/testdata/zot/command/blobs/index.json b/test/e2e/testdata/zot/command/blobs/index.json new file mode 100644 index 000000000..442b81d76 --- /dev/null +++ b/test/e2e/testdata/zot/command/blobs/index.json @@ -0,0 +1 @@ +{"schemaVersion":2,"manifests":null} \ No newline at end of file diff --git a/test/e2e/testdata/zot/command/blobs/oci-layout b/test/e2e/testdata/zot/command/blobs/oci-layout new file mode 100644 index 000000000..1343d370f --- /dev/null +++ b/test/e2e/testdata/zot/command/blobs/oci-layout @@ -0,0 +1 @@ +{"imageLayoutVersion":"1.0.0"} \ No newline at end of file