-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add E2E test for "kn source binding" commands #634
Conversation
Hi @MIBc. 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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
test/e2e/source_binding_test.go
Outdated
@@ -0,0 +1,73 @@ | |||
// Copyright 2019 The Knative Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copyright 2019 The Knative Authors | |
// Copyright 2020 The Knative Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
/assign @rhuss
/hold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MIBc thanks a lot! However, I think we should improve the test assertions as that we also verify that a write operation really gives the expected results. See below for some details.
test/e2e/source_binding_test.go
Outdated
test.sourceBindingUpdate(t, "my-binding1", "Deployment:apps/v1:myapp", "svc:testsvc1") | ||
out, err := test.kn.RunWithOpts([]string{"source", "binding", "describe", "my-binding1"}, runOpts{NoNamespace: false}) | ||
assert.NilError(t, err) | ||
assert.Check(t, strings.Contains(out, "testsvc1")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether we have the option to check whether there has been actually a server-side SinkBinding
CO has been created. The test looks good, but tbh the value is not much more than within the unit test which checks the actual output on the console for the command, too.
IMO any E2E test should verify, ideally with other channels than with kn
itself, whether the operation has been successfully performed.
So my preference for verifying a test would be:
- As the CO be created/updated with the content expected ?
- Or: If this is not possible or to difficult, then use e.g
kn binding describe
to check for it. E.g. one coudl do akn binding describe my-binding1 -o json
, parse the output an verify its content. This would at least give some enhanced certainty that the object has been created/update properly.
@MIBc do you think you could switch to kn binding describe -o json
here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kn source binding describe
does not support -o
.
How about kubectl get sinkbindings.sources.knative.dev my-binding -ojsonpath="{.spec.sink.ref.name}"
I find the getResourceFieldsWithJSONPath
can do this.
Fixes knative#631 * Add E2E test for "kn source binding" commands. * Fix typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, lgtm!
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien, MIBc, navidshaikh, rhuss 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 |
/retest |
1 similar comment
/retest |
Fixes #631
Proposed Changes
Release Note:
Add E2E test for "kn source binding" commands.