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

(refactor) address the e2e extract / refactor of issue #763 #765

Merged
merged 4 commits into from
Apr 1, 2020

Conversation

maximilien
Copy link
Contributor

@maximilien maximilien commented Mar 27, 2020

Description

Addresses the e2e part of issue #763. Moves common code to lib/test/integration

Changes

  • refactors the common e2e code into lib/test/integration
  • change package name of the common code from e2e to integration
  • change all e2e test to use new common code

Reference

Partially fix to issue #763

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 27, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maximilien

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 added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 27, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 27, 2020
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 27, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

@maximilien
Copy link
Contributor Author

/test pull-knative-client-build-tests

@maximilien maximilien requested a review from mattmoor March 27, 2020 03:22
@maximilien
Copy link
Contributor Author

/assign @rhuss @daisy-ycguo

@navidshaikh
Copy link
Collaborator

cause of build/e2e tests failure

test/e2e/service_export_import_apply_test.go:39:15: undefined: NewE2eTest
test/e2e/service_export_import_apply_test.go:45:7: undefined: NewKnRunResultCollector
test/e2e/service_export_import_apply_test.go:69:13: undefined: e2eTest
test/e2e/service_export_import_apply_test.go:69:53: undefined: KnRunResultCollector
test/e2e/service_export_import_apply_test.go:84:13: undefined: e2eTest
test/e2e/service_export_import_apply_test.go:84:66: undefined: KnRunResultCollector
test/e2e/service_export_import_apply_test.go:111:21: undefined: KnDefaultTestImage
test/e2e/trigger_test.go:63:2: undefined: test
test/e2e/trigger_test.go:64:2: undefined: test
test/e2e/trigger_test.go:65:2: undefined: test
test/e2e/trigger_test.go:65:2: too many errors

CHANGELOG.adoc Outdated Show resolved Hide resolved
CHANGELOG.adoc Outdated Show resolved Hide resolved
lib/test/integration/cli.go Outdated Show resolved Hide resolved
lib/test/integration/cli.go Outdated Show resolved Hide resolved
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package e2e
package integration
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO the package name could simply be e2e ?

imports like lib/test/e2e/flags

or even shorter lib/e2e/flags

Copy link
Member

Choose a reason for hiding this comment

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

agree with e2e for short, other than integration. just feel too long.
If we don't have libraries for unit test, maybe just lib/test/flags.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we use e2e it will conflict with the other one in test/e2e

Copy link
Collaborator

@navidshaikh navidshaikh Mar 31, 2020

Choose a reason for hiding this comment

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

If we use e2e it will conflict with the other one in test/e2e

How?

if we use test; the import path would look like (following Daisy's suggestion)

  • knative.dev/client/lib/test

while the one you mentioned would be

  • knative.dev/client/test/e2e

These are two different paths, I dont see any conflicts.
(even if we use e2e it would be lib/e2e/; still no conflicts as the parent path is different)

We need to get this right, as immediately after merge, there would be consumer of this import path.
Any subsequent change in this part of client repo would require changes in consumers as well.

lib/test/integration/integration.go Outdated Show resolved Hide resolved
lib/test/integration/result_collector.go Outdated Show resolved Hide resolved
lib/test/integration/result_collector.go Outdated Show resolved Hide resolved
lib/test/integration/cli.go Outdated Show resolved Hide resolved
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package e2e
package integration
Copy link
Member

Choose a reason for hiding this comment

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

agree with e2e for short, other than integration. just feel too long.
If we don't have libraries for unit test, maybe just lib/test/flags.go

lib/test/integration/cli.go Outdated Show resolved Hide resolved
test/e2e/basic_workflow_test.go Outdated Show resolved Hide resolved
@maximilien
Copy link
Contributor Author

Thanks for all the great feedback all. Will address today and push soon. Will get to it after lunch Pacific today.

@maximilien maximilien force-pushed the issue763_e2e_refactor branch from 1019ab3 to fd91fc7 Compare March 27, 2020 17:03
@maximilien
Copy link
Contributor Author

All feedback addressed. Let's see if we go green...

@maximilien
Copy link
Contributor Author

/test pull-knative-client-build-tests

@maximilien maximilien force-pushed the issue763_e2e_refactor branch from fd91fc7 to 10e07b3 Compare March 27, 2020 18:08
@maximilien
Copy link
Contributor Author

/test pull-knative-client-build-tests

@maximilien maximilien force-pushed the issue763_e2e_refactor branch 2 times, most recently from fa9b599 to 37aa3e1 Compare March 27, 2020 22:12
@maximilien
Copy link
Contributor Author

/test pull-knative-client-build-tests

@maximilien
Copy link
Contributor Author

OK foks we are green but pull-knative-client-build-tests and the error seems to be a flake:

go: extracting knative.dev/test-infra v0.0.0-20200327223851-0258d48ef3a8
go: finding github.com/google/licenseclassifier latest
go: finding github.com/sergi/go-diff v1.0.0
/home/prow/go/src/knative.dev/client
2020/03/28 00:24:27 No errors found.
Step failed: default_build_test_runner
============================
==== BUILD TESTS FAILED ====
============================
==== Fri Mar 27 17:24:27 PDT 2020
============================
Step failed: run_build_tests
+ EXIT_VALUE=1
+ set +o xtrace

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

lib/test/integration/integration.go Outdated Show resolved Hide resolved
@maximilien
Copy link
Contributor Author

maximilien commented Mar 31, 2020

But I solved the problems by running custom go test with "tekton" build tag:

go test ./test/e2e/ -test.v -tags "tekton" -run TestTektonPipeline

I could see the issues you listed and solved them. Let's see where CI is with this latest.

Thanks @navidshaikh

@maximilien maximilien force-pushed the issue763_e2e_refactor branch from 854e2d3 to 224dfe8 Compare March 31, 2020 00:28
@maximilien
Copy link
Contributor Author

Yeah, all green @navidshaikh and @rhuss

Can I get a LGTM. Thanks.

cc: @daisy-ycguo

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package e2e
package integration
Copy link
Collaborator

@navidshaikh navidshaikh Mar 31, 2020

Choose a reason for hiding this comment

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

If we use e2e it will conflict with the other one in test/e2e

How?

if we use test; the import path would look like (following Daisy's suggestion)

  • knative.dev/client/lib/test

while the one you mentioned would be

  • knative.dev/client/test/e2e

These are two different paths, I dont see any conflicts.
(even if we use e2e it would be lib/e2e/; still no conflicts as the parent path is different)

We need to get this right, as immediately after merge, there would be consumer of this import path.
Any subsequent change in this part of client repo would require changes in consumers as well.

@maximilien
Copy link
Contributor Author

Ok I’ll change integration to test today and update the PR. Lots of meetings for me on Tuesdays but will find time to do this and push it today.

@maximilien
Copy link
Contributor Author

@navidshaikh updated s/integration/test/, ready for LGTM. Thx.

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.

/lint

looking at result of refactoring, every lib util now need to take 3 testing related params, before it actually takes any operation related param, e.g:

func serviceCreate(t *testing.T, it *test.KnTest, r *test.KnRunResultCollector, serviceName string) {

There is repetition,
see:

type KnRunResultCollector struct {
  results    []KnRunResult
  extraDumps []string
  t          *testing.T
}

We can access testing.T from KnRunResultCollector in every test util function, this can be fixed
separately from this PR. @rhuss: WDYT?

lib/test/integration.go Show resolved Hide resolved
CHANGELOG.adoc Show resolved Hide resolved
lib/test/integration.go Show resolved Hide resolved
lib/test/cli.go Show resolved Hide resolved
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.

@navidshaikh: 5 warnings.

In response to this:

/lint

looking at result of refactoring, every lib util now need to take 3 testing related params, before it actually takes any operation related param, e.g:

func serviceCreate(t *testing.T, it *test.KnTest, r *test.KnRunResultCollector, serviceName string) {

There is repetition,
see:

type KnRunResultCollector struct {
 results    []KnRunResult
 extraDumps []string
 t          *testing.T
}

We can access testing.T from KnRunResultCollector in every test util function, this can be fixed
separately from this PR. @rhuss: WDYT?

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.

test/e2e/service_options_test.go Show resolved Hide resolved
test/e2e/traffic_split_test.go Show resolved Hide resolved
lib/test/result_collector.go Show resolved Hide resolved
test/e2e/source_apiserver_test.go Show resolved Hide resolved
test/e2e/source_apiserver_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

@maximilien : Lets merge this to unblock the -contrib work.
As a follow up to this PR, we should fix the docstring/typos.

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2020
@knative-prow-robot knative-prow-robot merged commit df78b8b into knative:master Apr 1, 2020
@navidshaikh
Copy link
Collaborator

followup issue to be fixed: #769

@maximilien
Copy link
Contributor Author

OK will push fix for #769 soon. Thanks

@maximilien maximilien deleted the issue763_e2e_refactor branch April 1, 2020 20:00
@maximilien
Copy link
Contributor Author

maximilien commented Apr 1, 2020

KnRunResultCollector

OK makes sense. But let me send this as a separate PR since that changes signatures and might require more agreements. Whereas the docs changes are non-controversial.

@navidshaikh navidshaikh added the backport/candidate Consider this PR to be backported to the release branch label Apr 15, 2020
rhuss pushed a commit to rhuss/knative-client that referenced this pull request Apr 15, 2020
…native#765)

* (refactor) address the e2e extract / refactor of issue knative#763

* various updates to address reviewers feedback

* renamed lib/test/integration to lib/test and package to test

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	CHANGELOG.adoc
#	test/e2e/service_export_import_apply_test.go
#	test/e2e/trigger_test.go
knative-prow-robot pushed a commit that referenced this pull request Apr 15, 2020
* (refactor) address the e2e extract / refactor of issue #763 (#765)

* (refactor) address the e2e extract / refactor of issue #763

* various updates to address reviewers feedback

* renamed lib/test/integration to lib/test and package to test

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	CHANGELOG.adoc
#	test/e2e/service_export_import_apply_test.go
#	test/e2e/trigger_test.go

* fix(plugin): Fix plugin lookup with file ext on Windows (#774)

* fix(plugin): Fix plugin lookup with file ext on Windows

* chore: Update changelog

* fix: Reflect review feedback

* fix: Reflect review feedback and add future todo

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	CHANGELOG.adoc

* fix(issue #762): correct error message when updating service (#778)

* fix(issue #762): correct error message when updating service

* correct message when updating service and passing many names
* fix issue with TestServiceUpdateWithMultipleImages running create vs update

* * added TestServiceDescribeWithMultipleNames
* added TestServiceCreateWithMultipleNames
* fix error message for service delete since many names can be passed

* Use vendored deps while running e2e locally (#783)

Also set GO111MODULE=on unconditionally

* Update sink binding create usage string (#785)

* Add "--target-utilization" to manage "autoscaling.knative.dev/targetUtilizationPercentage" annotation (#788)

* Support setting "autoscaling.knative.dev/targetUtilizationPercentage" annotation.

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	test/e2e/service_options_test.go

* Remove the delete propagation flag (#770)

* Remove the delete propagation flag

In it's current state it now takes me about 25 seconds for the `kn delete`
to complete. Before #682 it used to be
almost immediate. This is because we now pass in the
`DeletePropagationBackground` flag. I believe this is a mistake, not only
because of the 20+ seconds of additional time to delete things, but IMO
the CLI should talk to the server in the same way regardless of the --wait
flag. That flag should just be a CLI thing to indicate if the user wants the CLI
to wait for the server to complete but not HOW the server should do the delete.

Signed-off-by: Doug Davis <[email protected]>

* try just tweaking the --no-wait flag

Signed-off-by: Doug Davis <[email protected]>

* Fix error when output is set to name (#775)

* fix error when output is set to name

* add e2e test

* change to flags/listprint.go

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	test/e2e/basic_workflow_test.go

* Show all revisions when run `service describe -v` (#790)

* The `kn service describe -v` command shows repetitive revisions, because
  the revision would be covered by next one.

* Fix resource listing with -oname flag (#799)

* Fix resource listing with -oname flag

* add e2e tests

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	test/e2e/ping_test.go
#	test/e2e/revision_test.go
#	test/e2e/route_test.go
#	test/e2e/source_apiserver_test.go
#	test/e2e/source_binding_test.go
#	test/e2e/trigger_test.go

* Make wait, no-wait and async flags per bool var CLI convention (#802)

* Make wait, no-wait and async flags per bool var CLI convention

 Fixes #800

 - Deprecated bool vars can be supported for CLI convention
 - Bind --async flag value to --no-wait
 - Only one flag among [wait, no-wait, async] can be provided, else raise an error

* Simplify conditionals

* Add unit tests for deprecated flag async

* Fix a typo

* e2e: Foreground delete for revisions and services in e2e (#794)

* e2e: Foreground delete for revisions and services in e2e

 to avoid any race conditions and flakes

* Use --wait instead of --no-wait=false

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	test/e2e/basic_workflow_test.go
#	test/e2e/revision_test.go

* e2e: Run tekton e2e against pipeline v0.11.1 (#803)

* Use buildah task from master branch and paramterize FORMAT

* Configure pipeline v0.11.1

* DNM: Run tekton e2e in this PR

* Revert "DNM: Run tekton e2e in this PR"

This reverts commit 903f5be.

* Update CHANGELOG for v0.13.2 (#804)

* Pin serving to v0.13.2 and update version command (#797)

* Pin serving v0.13.2 dep to v0.13.2

* Update version command

 now points to serving v0.13.2 and eventing v0.13.6

* Copy go.sum as generated in CI

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	go.mod
#	go.sum
#	vendor/modules.txt

* add missing vendored files

* fixed error reporting for traffics tests

* Updated test

* fix formatting

* e2e for service export (#739)

* e2e for service export

* e2e for service export

* e2e for service export

* e2e for service export

* e2e for service export

Signed-off-by: Roland Huß <[email protected]>
# Conflicts:
#	test/e2e/service_export_import_apply_test.go

Co-authored-by: dr.max <[email protected]>
Co-authored-by: David Simansky <[email protected]>
Co-authored-by: Navid Shaikh <[email protected]>
Co-authored-by: Lv Jiawei <[email protected]>
Co-authored-by: Doug Davis <[email protected]>
Co-authored-by: Ying Chun Guo <[email protected]>
Co-authored-by: Murugappan Chetty <[email protected]>
@navidshaikh navidshaikh added backport/pr A backport PR which is target to a release branch. and removed backport/candidate Consider this PR to be backported to the release branch labels Apr 20, 2020
@rhuss rhuss added backported-to/0.13 and removed backport/pr A backport PR which is target to a release branch. labels Apr 20, 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants