From 7c63ed41f043dd5baa9b6b3b20c518a81268fb41 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Wed, 31 May 2023 15:58:59 +0800 Subject: [PATCH] fix: correct spec flag description (#964) Signed-off-by: Billy Zha --- cmd/oras/internal/option/spec.go | 2 +- test/e2e/suite/command/attach.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/oras/internal/option/spec.go b/cmd/oras/internal/option/spec.go index 9d994ff02..ccbb204fb 100644 --- a/cmd/oras/internal/option/spec.go +++ b/cmd/oras/internal/option/spec.go @@ -71,7 +71,7 @@ func (opts *distributionSpec) Parse() error { isApi := true opts.referrersAPI = &isApi default: - return fmt.Errorf("unknown image specification flag: %q", opts.specFlag) + return fmt.Errorf("unknown distribution specification flag: %q", opts.specFlag) } return nil } diff --git a/test/e2e/suite/command/attach.go b/test/e2e/suite/command/attach.go index e761a1a0e..54c35f6c3 100644 --- a/test/e2e/suite/command/attach.go +++ b/test/e2e/suite/command/attach.go @@ -60,6 +60,16 @@ var _ = Describe("ORAS beginners:", func() { ORAS("attach", "--artifact-type", "oras.test", LayoutRef(root, foobar.Tag)). ExpectFailure().MatchErrKeyWords("Error: no blob or manifest annotation are provided").Exec() }) + + It("should fail if distribution spec is unkown", func() { + ORAS("attach", "--artifact-type", "oras.test", RegistryRef(Host, ImageRepo, foobar.Tag), "--distribution-spec", "???"). + ExpectFailure().MatchErrKeyWords("unknown distribution specification flag").Exec() + }) + + It("should fail if image spec is unkown", func() { + ORAS("attach", "--artifact-type", "oras.test", RegistryRef(Host, ImageRepo, foobar.Tag), "--image-spec", "???"). + ExpectFailure().MatchErrKeyWords("unknown image specification flag").Exec() + }) }) })