mirror of https://github.com/knative/client.git
Adds info message after service create and delete operations (#95)
* Adds info message after service create operation Fixes #87 Aligns the service delete info message with service create too. * Updates per review comments Adds newline after std imports Line breaks at proper operator
This commit is contained in:
parent
39034a73f9
commit
5b8b9d53bc
|
|
@ -16,6 +16,7 @@ package commands
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
serving_lib "github.com/knative/client/pkg/serving"
|
||||
servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1"
|
||||
|
|
@ -73,7 +74,7 @@ func NewServiceCreateCommand(p *KnParams) *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "Service '%s' successfully created in namespace '%s'.\n", args[0], namespace)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
servinglib "github.com/knative/client/pkg/serving"
|
||||
|
|
@ -66,9 +67,8 @@ func fakeServiceCreate(args []string) (
|
|||
}
|
||||
|
||||
func TestServiceCreateImage(t *testing.T) {
|
||||
action, created, _, err := fakeServiceCreate([]string{
|
||||
action, created, output, err := fakeServiceCreate([]string{
|
||||
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz"})
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !action.Matches("create", "services") {
|
||||
|
|
@ -79,6 +79,9 @@ func TestServiceCreateImage(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
} else if conf.RevisionTemplate.Spec.Container.Image != "gcr.io/foo/bar:baz" {
|
||||
t.Fatalf("wrong image set: %v", conf.RevisionTemplate.Spec.Container.Image)
|
||||
} else if !strings.Contains(output, "foo") || !strings.Contains(output, "created") ||
|
||||
!strings.Contains(output, "default") {
|
||||
t.Fatalf("wrong stdout message: %v", output)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func NewServiceDeleteCommand(p *KnParams) *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "Deleted %s in %s namespace.\n", args[0], namespace)
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "Service '%s' successfully deleted in namespace '%s'.\n", args[0], namespace)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue