mirror of https://github.com/knative/client.git
* fix(issue #762): correct error message when updating service * correct message when updating service and passing many names * fix issue with TestServiceUpdateWithMultipleImages running create vs update * * added TestServiceDescribeWithMultipleNames * added TestServiceCreateWithMultipleNames * fix error message for service delete since many names can be passed
This commit is contained in:
parent
8a60d2ebf8
commit
70f96a102c
|
|
@ -26,6 +26,10 @@
|
||||||
| Fix plugin lookup with file ext on Windows
|
| Fix plugin lookup with file ext on Windows
|
||||||
| https://github.com/knative/client/pull/774[#774]
|
| 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)
|
## v0.13.1 (2020-03-25)
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,13 @@ func TestServiceCreateWithMultipleImages(t *testing.T) {
|
||||||
assert.Assert(t, util.ContainsAll(err.Error(), "\"--image\"", "\"gcr.io/bar/foo:baz\"", "flag", "once"))
|
assert.Assert(t, util.ContainsAll(err.Error(), "\"--image\"", "\"gcr.io/bar/foo:baz\"", "flag", "once"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServiceCreateWithMultipleNames(t *testing.T) {
|
||||||
|
_, _, _, err := fakeServiceCreate([]string{
|
||||||
|
"service", "create", "foo", "foo1", "--image", "gcr.io/foo/bar:baz", "--no-wait"}, false)
|
||||||
|
|
||||||
|
assert.Assert(t, util.ContainsAll(err.Error(), "'service create' requires the service name given as single argument"))
|
||||||
|
}
|
||||||
|
|
||||||
func TestServiceCreateImageSync(t *testing.T) {
|
func TestServiceCreateImageSync(t *testing.T) {
|
||||||
action, created, output, err := fakeServiceCreate([]string{
|
action, created, output, err := fakeServiceCreate([]string{
|
||||||
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz"}, false)
|
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz"}, false)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func NewServiceDeleteCommand(p *commands.KnParams) *cobra.Command {
|
||||||
|
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
return errors.New("requires the service name")
|
return errors.New("'service delete' requires the service name(s)")
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace, err := p.GetNamespace(cmd)
|
namespace, err := p.GetNamespace(cmd)
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ func NewServiceDescribeCommand(p *commands.KnParams) *cobra.Command {
|
||||||
Short: "Show details of a service",
|
Short: "Show details of a service",
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) != 1 {
|
if len(args) != 1 {
|
||||||
return errors.New("'kn service describe' requires name of the service as single argument")
|
return errors.New("'service describe' requires the service name given as single argument")
|
||||||
}
|
}
|
||||||
serviceName := args[0]
|
serviceName := args[0]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,16 @@ func TestServiceDescribeBasic(t *testing.T) {
|
||||||
r.Validate()
|
r.Validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServiceDescribeWithMultipleNames(t *testing.T) {
|
||||||
|
client := knclient.NewMockKnServiceClient(t)
|
||||||
|
r := client.Recorder()
|
||||||
|
createTestService("foo", []string{"rev1"}, goodConditions())
|
||||||
|
_, err := executeServiceCommand(client, "describe", "foo", "foo1")
|
||||||
|
|
||||||
|
assert.Assert(t, util.ContainsAll(err.Error(), "'service describe' requires the service name given as single argument"))
|
||||||
|
r.Validate()
|
||||||
|
}
|
||||||
|
|
||||||
func TestServiceDescribeSad(t *testing.T) {
|
func TestServiceDescribeSad(t *testing.T) {
|
||||||
client := knclient.NewMockKnServiceClient(t)
|
client := knclient.NewMockKnServiceClient(t)
|
||||||
r := client.Recorder()
|
r := client.Recorder()
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ func NewServiceUpdateCommand(p *commands.KnParams) *cobra.Command {
|
||||||
Example: updateExample,
|
Example: updateExample,
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
if len(args) != 1 {
|
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)
|
namespace, err := p.GetNamespace(cmd)
|
||||||
|
|
|
||||||
|
|
@ -195,11 +195,19 @@ func TestServiceUpdateImage(t *testing.T) {
|
||||||
func TestServiceUpdateWithMultipleImages(t *testing.T) {
|
func TestServiceUpdateWithMultipleImages(t *testing.T) {
|
||||||
orig := newEmptyService()
|
orig := newEmptyService()
|
||||||
_, _, _, err := fakeServiceUpdate(orig, []string{
|
_, _, _, 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"))
|
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) {
|
func TestServiceUpdateCommand(t *testing.T) {
|
||||||
orig := newEmptyService()
|
orig := newEmptyService()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue