Skip to content

Commit

Permalink
Added unit test for --timeout flag
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasgun committed Apr 12, 2022
1 parent 9b5a9c4 commit 158ccab
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/kn/commands/service/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ func TestServiceCreateCommand(t *testing.T) {
assert.DeepEqual(t, template.Spec.Containers[0].Command, []string{"sh", "/app/start.sh"})
}

func TestServiceCreateTimeout(t *testing.T) {
action, created, _, err := fakeServiceCreate([]string{
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz", "--timeout", "2"}, false)
assert.NilError(t, err)
assert.Assert(t, action.Matches("create", "services"))

timeoutSeconds := *created.Spec.Template.Spec.TimeoutSeconds
assert.NilError(t, err)
assert.DeepEqual(t, int64(2), timeoutSeconds)
}

func TestServiceCreateArg(t *testing.T) {
action, created, _, err := fakeServiceCreate([]string{
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz",
Expand Down

0 comments on commit 158ccab

Please sign in to comment.