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 tests for trigger #645

Merged
merged 2 commits into from
Feb 12, 2020
Merged

Conversation

daisy-ycguo
Copy link
Member

@daisy-ycguo daisy-ycguo commented Feb 10, 2020

Fixes #568

Proposed Changes

  • Add e2e tests for trigger
  • Add retry mechanism in trigger update when meeting with conflicting error.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 10, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 10, 2020
@daisy-ycguo daisy-ycguo force-pushed the triggere2e branch 3 times, most recently from fc76456 to 54d1e78 Compare February 10, 2020 08:46
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.

Looks good, but aren't you missing some tests for which you already prepared some private methods ? (like update, delete, or with error) ?

assert.Check(t, util.ContainsAllIgnoreCase(out, "Trigger", name, "created", "namespace", test.kn.namespace))
}

func (test *e2eTest) triggerCreateMissingSink(t *testing.T, name string, resources string, sa string, sink string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

where is this test called ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for the review @rhuss. Yes, this is not completed. still working on other test cases


_, err := kubectl.RunWithOpts([]string{"label", "namespace", test.kn.namespace, "knative-eventing-injection=enabled"}, runOpts{})
if err != nil {
t.Fatalf("Error executing 'kubectl lable namespace %s knative-eventing-injection=enabled'. Error: %s", test.kn.namespace, err.Error())
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
t.Fatalf("Error executing 'kubectl lable namespace %s knative-eventing-injection=enabled'. Error: %s", test.kn.namespace, err.Error())
t.Fatalf("Error executing 'kubectl label namespace %s knative-eventing-injection=enabled'. Error: %s", test.kn.namespace, err.Error())

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, will fix it in next commit.

@rhuss
Copy link
Contributor

rhuss commented Feb 10, 2020

/retest

@daisy-ycguo daisy-ycguo changed the title Add E2E tests for trigger WIP: Add E2E tests for trigger Feb 10, 2020
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 10, 2020
@rhuss
Copy link
Contributor

rhuss commented Feb 10, 2020

@daisy-ycguo there seems to be compile errors:

# knative.dev/client/test/e2e [knative.dev/client/test/e2e.test]
test/e2e/trigger_test.go:54:28: undefined: Interval
test/e2e/trigger_test.go:54:38: undefined: Timeout

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.

Incomplete...

}

return wait.PollImmediate(Interval, Timeout, func() (bool, error) {
out, err := kubectl.RunWithOpts([]string{"get", "broker", "-n", test.kn.namespace, "-o=jsonpath='{.items[0].status.conditions[?(@.type==\"Ready\")].status}'"}, runOpts{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check this err:
assert.NilError(t, err)
no point in propagating as this is a test

Copy link
Member Author

Choose a reason for hiding this comment

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

exactly. checked in the new version.

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 10, 2020
@daisy-ycguo
Copy link
Member Author

/test pull-knative-client-integration-tests

@daisy-ycguo daisy-ycguo force-pushed the triggere2e branch 4 times, most recently from abd234e to 16f1715 Compare February 11, 2020 08:28
@daisy-ycguo daisy-ycguo changed the title WIP: Add E2E tests for trigger Add E2E tests for trigger Feb 11, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 11, 2020
@daisy-ycguo daisy-ycguo force-pushed the triggere2e branch 2 times, most recently from e113654 to 5dca113 Compare February 11, 2020 08:44
@rhuss
Copy link
Contributor

rhuss commented Feb 11, 2020

=== RUN   TestBasicWorkflow/create_hello_service_and_return_no_error
Running 'kn service create hello --image gcr.io/knative-samples/helloworld-go -n kne2etests6'...
Failed to successfully execute 'kubectl lable namespace kne2etests7 knative-eventing-injection=enabled': Execution error: stderr: 'Error: unknown command "lable" for "kubectl"

Did you mean this?
	label

Run 'kubectl --help' for usage.
unknown command "lable" for "kubectl"

Did you mean this?
	label

' error: 'exit status 1'FAIL	knative.dev/client/test/e2e	1.969s
FAIL

@daisy-ycguo daisy-ycguo force-pushed the triggere2e branch 2 times, most recently from 1261c06 to 27996da Compare February 11, 2020 09:44
func (test *e2eTest) triggerCreate(t *testing.T, name string, filters []string, sinksvc string) {
filterStr := ""
for _, v := range filters {
filterStr = filterStr + "--filter " + v + " "
Copy link
Contributor

Choose a reason for hiding this comment

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

You can't concatenate the filters like this in a string as this will then considered to be a single argument (not multiple ones as you would expect). See also the error in the integration test.

Instead you should put all in a string array, adding the broked and sink args in the end and then use that slice to put into the RunWithOpts call (with "..." to convert to varargs)

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah. fixing it.

@daisy-ycguo daisy-ycguo force-pushed the triggere2e branch 2 times, most recently from 96ff88c to 21e56cd Compare February 11, 2020 13:20
@daisy-ycguo daisy-ycguo force-pushed the triggere2e branch 5 times, most recently from 8571a03 to f928f6c Compare February 11, 2020 16:14
@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/trigger/update.go 86.7% 80.4% -6.3

@daisy-ycguo
Copy link
Member Author

/test pull-knative-client-integration-tests

@daisy-ycguo
Copy link
Member Author

@rhuss @maximilien @navidshaikh This PR is ready for review and merge if possible. Thanks.

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 12, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: daisy-ycguo, maximilien, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@navidshaikh
Copy link
Collaborator

/retest

Failed to successfully execute 'kn service create hello --image gcr.io/knative-samples/helloworld-go -n kne2etests1': Execution error: stderr: 'timeout: service 'hello' not ready after 600 seconds

and

    --- FAIL: TestTrafficSplit/tag_latest_ready_revision_of_service_as_current (4.62s)

ref: logs

@knative-prow-robot knative-prow-robot merged commit e031917 into knative:master Feb 12, 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. 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.

Add E2E tests for trigger
7 participants