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

🌱 Migrate envtest setup to envtest.Run, add CAPI_DISABLE_TEST_ENV option #5030

Merged

Conversation

sbueringer
Copy link
Member

Signed-off-by: Stefan Büringer [email protected]

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #5029

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 28, 2021
@sbueringer
Copy link
Member Author

sbueringer commented Jul 28, 2021

First version to find out if we have consensus on the implementation. After we got that, I would extend the PR to add a few sentences how to:

  • run unit tests with disabled test env
  • run unit tests with an existing Kubernetes cluster (ref: USE_EXISTING_CLUSTER)

to: https://cluster-api.sigs.k8s.io/developer/testing.html#running-unit-and-integration-tests

@sbueringer sbueringer changed the title 🌱 add env var to disable test env during unit test execution [WIP] 🌱 add env var to disable test env during unit test execution Jul 29, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 29, 2021
@sbueringer sbueringer force-pushed the pr-add-disable-test-env branch from cec54a4 to 5962c3c Compare August 9, 2021 13:40
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 9, 2021
@sbueringer sbueringer changed the title [WIP] 🌱 add env var to disable test env during unit test execution 🌱 add env var to disable test env during unit test execution Aug 9, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2021
internal/envtest/environment.go Outdated Show resolved Hide resolved
internal/envtest/environment.go Outdated Show resolved Hide resolved
internal/envtest/environment.go Outdated Show resolved Hide resolved
internal/envtest/environment.go Show resolved Hide resolved
api/v1alpha3/suite_test.go Outdated Show resolved Hide resolved
exp/addons/api/v1alpha3/suite_test.go Show resolved Hide resolved
controllers/suite_test.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member Author

sbueringer commented Aug 10, 2021

And now also fixed some nil pointers I missed before :/. At least locally all tests are successful now.

@vincepri PTAL :) (I also answered to the remaining open conversations above)

@vincepri
Copy link
Member

Let's squash commits

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2021
@vincepri
Copy link
Member

And retitle the PR 🙃

@sbueringer sbueringer force-pushed the pr-add-disable-test-env branch from aa4a842 to 6a21abc Compare August 10, 2021 17:20
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2021
@sbueringer sbueringer force-pushed the pr-add-disable-test-env branch from 6a21abc to 7c9a332 Compare August 10, 2021 17:22
@sbueringer sbueringer changed the title 🌱 add env var to disable test env during unit test execution 🌱 Migrate envtest setup to envtest.Run, add CAPI_DISABLE_TEST_ENV option Aug 10, 2021
@sbueringer
Copy link
Member Author

sbueringer commented Aug 10, 2021

@vincepri rebased, ajusted commit message, retitled PR. Feel free to retitle, I tried to express the main points and keep it somewhat concise

P.S. I assumed that we want to keep utilruntime.Must(AddToScheme(scheme.Scheme)) as is

@fabriziopandini
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 10, 2021
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2021
@sbueringer
Copy link
Member Author

/retest
the usual flake

@k8s-ci-robot k8s-ci-robot merged commit 46a708d into kubernetes-sigs:master Aug 10, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone Aug 10, 2021
@sbueringer sbueringer deleted the pr-add-disable-test-env branch August 10, 2021 19:05
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve execution speed of unit tests
4 participants