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

✨deploy-image/v1-alpha: add a todo comment for users stating envtest limitations #2859

Merged

Conversation

NikhilSharmaWe
Copy link
Member

Description

Added a todo comment for users in controller_test.go file for deploy-image/v1-alpha plugin, highlighting the limitations of the envtest.

Motivation

Closes: #2856

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 5, 2022
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

That is great for me

@mogsie

WDYT ?

Could you move here?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, NikhilSharmaWe

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 5, 2022
@mogsie
Copy link
Contributor

mogsie commented Aug 10, 2022

I'm sorry, when you say "move" do you mean move my code changes, or actually propose changes to the scaffold that fixes these issues (by making it possible to use several namespaces)?

The TODO helps of course. It's important that users are aware of the limitation. 👍

But even better would be code that supported several tests.

@@ -60,6 +60,8 @@ var _ = Describe("Busybox controller", func() {
})

AfterEach(func() {
// TODO(user): Attention if you improve this code by adding other context test you MUST
// be aware of the current delete namespace limitations. More info: https://book.kubebuilder.io/reference/envtest.html#testing-considerations
By("Deleting the Namespace to perform the tests")
_ = k8sClient.Delete(ctx, namespace)

Copy link
Member

Choose a reason for hiding this comment

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

HI @mogsie,

I'm sorry, when you say "move" do you mean move my code changes, or actually propose changes to the scaffold that fixes these issues (by making it possible to use several namespaces)?

I could not follow this one.

The TODO helps of course. It's important that users are aware of the limitation. 👍
But even better would be code that supported several tests.

Will we have in all case scenarios many tests?
OR in many cases to unit test the controller we might have only one test that just checks the reconciliation.

So, I think we can add the TODO here and ensure that it is still simple.
However, we can also add an example in the docs WDYT? Also, we probably need to vote on the C+R issue and see if we can address this one. The ideal solution for me shows we fix it in the C+R and we just let people know about that now. WDYT? Could we agree?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the TODO approach is best. It allows the developers to make the choice:

  • Either I keep within the single namespace, and clean up nicely after myself whenever I need to, and avoid problems like that
  • Or I decide to make new namespaces for each new test, with the additional extra work needed.

Personally, I like having the ability to write integration tests and not have to worry about cleaning up, especially while developing, when I may not have completed the clean-up portion of the controller. In those cases, cleaning up is difficult. But it's not always needed, so I think the TODO comment is the best approach.

Copy link
Member

Choose a reason for hiding this comment

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

That is terrific. So, let's move forward with this one since we have your :

/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 11, 2022
@k8s-ci-robot k8s-ci-robot merged commit eb228bd into kubernetes-sigs:master Aug 11, 2022
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sample test code breaks when a second test is added
4 participants