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

Add E2E test for "kn source binding" commands #634

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

MIBc
Copy link
Contributor

@MIBc MIBc commented Feb 4, 2020

Fixes #631

Proposed Changes

  • Add E2E test for "kn source binding" commands.
  • Fix typo.

Release Note:

  • 🎁 Add new feature
    Add E2E test for "kn source binding" commands.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 4, 2020
@knative-prow-robot
Copy link
Contributor

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 /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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 4, 2020
@navidshaikh
Copy link
Collaborator

/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 Feb 4, 2020
docs/cmd/kn_source_binding_create.md Show resolved Hide resolved
@@ -0,0 +1,73 @@
// Copyright 2019 The Knative Authors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Copyright 2019 The Knative Authors
// Copyright 2020 The Knative Authors

test/e2e/source_binding_test.go Show resolved Hide resolved
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

/assign @rhuss
/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2020
@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 4, 2020
Copy link
Contributor

@rhuss rhuss left a 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.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"))
Copy link
Contributor

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 a kn 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 ?

Copy link
Contributor Author

@MIBc MIBc Feb 7, 2020

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.
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 7, 2020
Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

thanks, lgtm!

/lgtm

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

[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:
  • OWNERS [maximilien,navidshaikh,rhuss]

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

@rhuss rhuss removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 7, 2020
@rhuss
Copy link
Contributor

rhuss commented Feb 7, 2020

/retest

1 similar comment
@rhuss
Copy link
Contributor

rhuss commented Feb 7, 2020

/retest

@knative-prow-robot knative-prow-robot merged commit 16bbfa3 into knative:master Feb 7, 2020
@MIBc MIBc deleted the e2e-sinkbind branch February 8, 2020 08:39
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add E2E test for "kn source binding" commands
6 participants