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

e2e: restructure e2e framework and its sub-packages to solve potential cycle imports #109224

Closed

Conversation

kidlj
Copy link
Contributor

@kidlj kidlj commented Apr 1, 2022

What type of PR is this?

/kind cleanup
/kind api-change

What this PR does / why we need it:

Currently, many e2e functionalities are divided into sub packages from framework itself. The framework as a hub to its sub-packages must import some or all of these sub-packages to provide functionalitiies to test cases, however, some framework sub-packages import framework package back, notably to use framework.TestContext, its log and exec utils, framework.Namespace.Name etc, which may cause many potential circular imports to happen. See #81245

This PR did one thing: to avoid e2e framework sub-packages from importing framework package. To achieve this goal, this PR made these changes:

  1. Move framework utils to framework/utils package; and change some of them to accept explicit arguments passed from framework instead of referencing *framework directly(notably f.ClientSet and f.Namespace.Name).
  2. Move framework.TestContext to framework/config package.
  3. Remove FrameworkBeforeEach(f *Framework) and FrameworkAfterEach(f *Framework) from ProviderInterface interface, since none of them is ever used.
  4. Move framework.TimeoutContext to framework/config package.
  5. Modify e2e tests to reflect on these changes.

Which issue(s) this PR fixes:

Fixes #81245

Special notes for your reviewer:

Since it's huge, this PR serves as a POC of this refactoring to pass all tests; If it can be accepted, I would like to separate this PR into several sub-PRs for ease to review, and some more cleanup will be done later.

/cc @oomichi , @BenTheElder

Does this PR introduce a user-facing change?

NONE

But projects that import e2e framework or its sub-packages may face API changes.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 1, 2022
@k8s-ci-robot
Copy link
Contributor

@kidlj: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 1, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @kidlj. Thanks for your PR.

I'm waiting for a kubernetes 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/conformance Issues or PRs related to kubernetes conformance tests area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/kubeadm area/network-policy Issues or PRs related to Network Policy subproject area/test labels Apr 1, 2022
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/network Categorizes an issue or PR as relevant to SIG Network. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 1, 2022
@k8s-triage-robot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kidlj
To complete the pull request process, please assign spiffxp after the PR has been reviewed.
You can assign the PR to them by writing /assign @spiffxp in a comment when ready.

The full list of commands accepted by this bot can be found 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

@kidlj
Copy link
Contributor Author

kidlj commented Apr 1, 2022

/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Apr 1, 2022

@kidlj: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-integration a01742a link true /test pull-kubernetes-integration

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@liggitt
Copy link
Member

liggitt commented Apr 4, 2022

I haven't looked at the changes in this PR, but did want to note an issue that a previous e2e framework refactor caused - #103697

Ginkgo is tricky enough to reason about that it's not always clear what side effects a refactor might have. Reviews of this PR should consider whether any of the changes could trigger something like #103697

@mauriciopoppe
Copy link
Member

There was a PR that I worked on that stalled #100304 with a doc https://docs.google.com/document/d/12QckcyZpBzmgdQZ91h21co4J0rtoXIH76QJBgR1nD6Y/edit#heading=h.xmmbjkrz1oj9, I'd suggest writing one to have a better picture of the proposed change.

I'd also suggest to split the changes in multiple PRs for the reviewers, it's going to be hard keeping track of changes in +400 files.

@kidlj
Copy link
Contributor Author

kidlj commented Apr 4, 2022

@mauriciopoppe Sure, thanks for the kind suggestion. This PR serves as a POC for the refactoring to pass all tests, so if it can be accepted, I would like to divide it into several sub-PRs, and with some documentations.

@aojea
Copy link
Member

aojea commented Apr 4, 2022

I'm -1 until we have a clear analysis of pros and cons, I personally had to spend a lot of time chasing flakes and bugs because of unexpected dependencies on test that broke on the previous refactor

@k8s-ci-robot
Copy link
Contributor

@kidlj: PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 4, 2022
@ehashman ehashman added this to Waiting on Author in SIG Node PR Triage Apr 4, 2022
@cici37
Copy link
Contributor

cici37 commented Apr 5, 2022

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Apr 5, 2022
@kidlj
Copy link
Contributor Author

kidlj commented Apr 6, 2022

I'm -1 until we have a clear analysis of pros and cons, I personally had to spend a lot of time chasing flakes and bugs because of unexpected dependencies on test that broke on the previous refactor

I understand. But the circular imports issue from e2e core framework and its sub-package has been stuck for a long time, making writing tests kind of hard; and I don't see another way fixing it without refactoring. So how about we do it little by little, aspect by aspect, with detailed documentation and sub-PRs to fix this issue? If OK, I'd like to open a meta issue to manage the process. Thanks.

@SergeyKanzhelev SergeyKanzhelev moved this from Triage to Archive-it in SIG Node CI/Test Board Apr 6, 2022
@logicalhan
Copy link
Member

/remove-sig instrumentation

@k8s-ci-robot k8s-ci-robot removed the sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. label Apr 7, 2022
@aojea
Copy link
Member

aojea commented Apr 8, 2022

I understand. But the circular imports issue from e2e core framework and its sub-package has been stuck for a long time, making writing tests kind of hard; and I don't see another way fixing it without refactoring. So how about we do it little by little, aspect by aspect, with detailed documentation and sub-PRs to fix this issue? If OK, I'd like to open a meta issue to manage the process. Thanks.

yeah, I meant something like that, step by step and some place tracking the job done and remaining 😄

@enj enj added this to Needs Triage in SIG Auth Old Apr 9, 2022
@kidlj
Copy link
Contributor Author

kidlj commented Apr 20, 2022

This PR is way too large to review, and I opened an umbrella issue to track the process of this refactoring and hoped to do it little by little, if triage accepted. So please discuss it there and this PR will be closed.

/close

SIG Node CI/Test Board automation moved this from Archive-it to Done Apr 20, 2022
@k8s-ci-robot
Copy link
Contributor

@kidlj: Closed this PR.

In response to this:

This PR is way too large to review, and I opened an umbrella issue to track the process of this refactoring and hoped to do it little by little, if triage accepted. So please discuss it there and this PR will be closed.

/close

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.

SIG Node PR Triage automation moved this from Waiting on Author to Done Apr 20, 2022
@ritazh ritazh removed this from Needs Triage in SIG Auth Old May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/conformance Issues or PRs related to kubernetes conformance tests area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/kubeadm area/network-policy Issues or PRs related to Network Policy subproject area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. sig/windows Categorizes an issue or PR as relevant to SIG Windows. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

Core e2e test framework should not import sub e2e test frameworks
9 participants