Skip to content

Commit

Permalink
add test to attach twice
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Jan 25, 2024
1 parent 250d40c commit e9df29f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/e2e/suite/command/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ var _ = Describe("1.1 registry users:", func() {
Expect(out).To(gbytes.Say(RegistryRef(ZOTHost, testRepo, "")))
})

It("should attach a file to a subject twice", func() {
// prepare
testRepo := attachTestRepo("attach-twice")
tempDir := PrepareTempFiles()
subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag)
CopyZOTRepo(ImageRepo, testRepo)
// test
ref1 := ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia), "--format", "{{.Ref}}").
WithWorkDir(tempDir).Exec().Out.Contents()
ref2 := ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia), "--format", "{{.Ref}}").
WithWorkDir(tempDir).Exec().Out.Contents()
// validate
ORAS("discover", subjectRef, "--format", "{{range .Manifests}}{{println .Ref}}{{end}}").MatchKeyWords(string(ref1), string(ref2)).Exec()
})

It("should attach a file via a OCI Image", func() {
testRepo := attachTestRepo("image")
tempDir := PrepareTempFiles()
Expand Down

0 comments on commit e9df29f

Please sign in to comment.