Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Panic for kn source apiserver and kn source binding describe with Sink URI #901

Merged

Conversation

danielhelfand
Copy link
Contributor

Description

Following up on #848 and #900, this pull request updates kn source apiserver and kn source binding describe to avoid a panic when using a Sink that has a URI instead of a Ref.

This pull request also updates unit tests for apiserver and binding as some tests are not asserting whether output of commands is correct.

/lint

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 22, 2020
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielhelfand: 0 warnings.

In response to this:

Description

Following up on #848 and #900, this pull request updates kn source apiserver and kn source binding describe to avoid a panic when using a Sink that has a URI instead of a Ref.

This pull request also updates unit tests for apiserver and binding as some tests are not asserting whether output of commands is correct.

/lint

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 22, 2020
@knative-prow-robot
Copy link
Contributor

Hi @danielhelfand. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 22, 2020
@danielhelfand danielhelfand changed the title fix panic for apiserver and binding describe and update tests Fix Panic for kn source apiserver and kn source binding describe with Sink URI Jun 22, 2020
@danielhelfand danielhelfand force-pushed the panic_apiserver_binding branch from 22891d6 to 2410198 Compare June 22, 2020 15:54
Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments. Lacks tests coverage.

pkg/kn/commands/source/apiserver/describe.go Show resolved Hide resolved
pkg/kn/commands/source/apiserver/describe.go Show resolved Hide resolved
pkg/kn/commands/source/binding/describe.go Show resolved Hide resolved
@maximilien
Copy link
Contributor

/ok-to-test

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 22, 2020
@navidshaikh navidshaikh added this to the v0.16.0 milestone Jun 23, 2020
Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a few minor nits but rest lgtm

CHANGELOG.adoc Outdated Show resolved Hide resolved
pkg/kn/commands/source/apiserver/apiserver_test.go Outdated Show resolved Hide resolved
Comment on lines 33 to 49
sinkRefsvc1 = duckv1.Destination{
Ref: &duckv1.KReference{
Kind: "Service",
Name: "svc1",
APIVersion: "serving.knative.dev/v1",
Namespace: "default",
},
}

sinkRefsvc2 = duckv1.Destination{
Ref: &duckv1.KReference{
Kind: "Service",
Name: "svc2",
APIVersion: "serving.knative.dev/v1",
Namespace: "default",
},
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about function sinkv1(service, namespace, string) and use that inline wherever needed ?

(could be done in a follow up)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a createSinkv1 func in apiserver_test.go. Turns out this same func exists for binding already as createServiceSink. If there is a location to recommend, we could use the same func for both, but let me know what's preferred with regard to that.

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2020
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/source/apiserver/describe.go 85.2% 86.9% 1.6
pkg/kn/commands/source/binding/describe.go 90.8% 92.3% 1.5

@danielhelfand
Copy link
Contributor Author

/test pull-knative-client-integration-tests

@maximilien
Copy link
Contributor

Please address @navidshaikh comments. Otherwise LGTM

@danielhelfand
Copy link
Contributor Author

Please address @navidshaikh comments. Otherwise LGTM

Should all be addressed, but can wait for @navidshaikh to clarify if I've missed anything.

Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

thanks!

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielhelfand, navidshaikh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit ab67948 into knative:master Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants