Skip to content

Commit

Permalink
fix(issue #762): correct error message when updating service
Browse files Browse the repository at this point in the history
* correct message when updating service and passing many names
* fix issue with TestServiceUpdateWithMultipleImages running create vs update
  • Loading branch information
maximilien committed Apr 3, 2020
1 parent 2e4ff2b commit 65eea39
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
| Fix plugin lookup with file ext on Windows
| https://github.com/knative/client/pull/774[#774]

| 🐛
| correct error message when updating service
| https://github.com/knative/client/pull/778[#778]

|===

## v0.13.1 (2020-03-25)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kn/commands/service/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewServiceUpdateCommand(p *commands.KnParams) *cobra.Command {
Example: updateExample,
RunE: func(cmd *cobra.Command, args []string) (err error) {
if len(args) != 1 {
return errors.New("requires the service name")
return errors.New("'service update' requires the service name given as single argument")
}

namespace, err := p.GetNamespace(cmd)
Expand Down
10 changes: 9 additions & 1 deletion pkg/kn/commands/service/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,19 @@ func TestServiceUpdateImage(t *testing.T) {
func TestServiceUpdateWithMultipleImages(t *testing.T) {
orig := newEmptyService()
_, _, _, err := fakeServiceUpdate(orig, []string{
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz", "--image", "gcr.io/bar/foo:baz", "--no-wait"})
"service", "update", "foo", "--image", "gcr.io/foo/bar:baz", "--image", "gcr.io/bar/foo:baz", "--no-wait"})

assert.Assert(t, util.ContainsAll(err.Error(), "\"--image\"", "\"gcr.io/bar/foo:baz\"", "flag", "once"))
}

func TestServiceUpdateWithMultipleNames(t *testing.T) {
orig := newEmptyService()
_, _, _, err := fakeServiceUpdate(orig, []string{
"service", "update", "foo", "foo1", "--image", "gcr.io/foo/bar:baz", "--no-wait"})

assert.Assert(t, util.ContainsAll(err.Error(), "'service update' requires the service name given as single argument"))
}

func TestServiceUpdateCommand(t *testing.T) {
orig := newEmptyService()

Expand Down

0 comments on commit 65eea39

Please sign in to comment.