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

Update controllers package tests #190

Closed
2 tasks
Tracked by #189
perdasilva opened this issue May 9, 2023 · 6 comments · Fixed by #541
Closed
2 tasks
Tracked by #189

Update controllers package tests #190

perdasilva opened this issue May 9, 2023 · 6 comments · Fixed by #541
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Comments

@perdasilva
Copy link
Contributor

perdasilva commented May 9, 2023

Description


Follow the testing guidelines set forth in #188 and refactor the controllers package unit tests. Be sure to fix all **/*_test.go files.

Pre-Conditions


Acceptance Criteria


@joelanford
Copy link
Member

How do we plan to handle the BeforeSuite/AfterSuite setup that ginkgo provides? It handles things like setup/teardown of envtest, creation of a rest.Config object that tests can use to interact with the envtest apiserver, setup of a scheme, etc.

@perdasilva perdasilva changed the title update controller package tests Update controller package tests May 9, 2023
@perdasilva perdasilva added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels May 9, 2023
@perdasilva
Copy link
Contributor Author

How do we plan to handle the BeforeSuite/AfterSuite setup that ginkgo provides? It handles things like setup/teardown of envtest, creation of a rest.Config object that tests can use to interact with the envtest apiserver, setup of a scheme, etc.

That's a great call out. Maybe we should only have the controller unit tests using ginkgo, and the rest on go test?

@m1kola
Copy link
Member

m1kola commented Aug 7, 2023

Unit tests don't need envtest. Majority of our tests should be unit tests (think testing pyramid). Ones that require envtest are likely integration/e2e tests and we should probably keep them as Ginkgo tests.

@ncdc
Copy link
Member

ncdc commented Aug 7, 2023

I'd like to eliminate Ginkgo entirely. I find it difficult to understand (BeforeEach, JustBeforeEach, BeforeSuite) and have an easier time reasoning about standard go tests (optionally table tests).

@m1kola
Copy link
Member

m1kola commented Aug 7, 2023

@ncdc I'm not a big fan of Ginkgo too. Do you know any good examples of codebases which use standard go tests for e2e/integration tests? If yes - could you please share links? I can't think of any and in my head it looks even worse than with Ginkgo (setup, tear down).

@ncdc
Copy link
Member

ncdc commented Aug 7, 2023

kcp

@tmshort tmshort changed the title Update controller package tests Update controllers package tests Sep 7, 2023
@tmshort tmshort self-assigned this Sep 8, 2023
tmshort added a commit to tmshort/operator-controller that referenced this issue Nov 13, 2023
Fix operator-framework#190

Signed-off-by: Todd Short <tshort@redhat.com>
tmshort added a commit to tmshort/operator-controller that referenced this issue Nov 13, 2023
Fix operator-framework#190

Signed-off-by: Todd Short <tshort@redhat.com>
tmshort added a commit to tmshort/operator-controller that referenced this issue Nov 13, 2023
Fix operator-framework#190

Signed-off-by: Todd Short <tshort@redhat.com>
tmshort added a commit to tmshort/operator-controller that referenced this issue Nov 14, 2023
Fix operator-framework#190

Signed-off-by: Todd Short <tshort@redhat.com>
tmshort added a commit to tmshort/operator-controller that referenced this issue Nov 15, 2023
Fix operator-framework#190

Signed-off-by: Todd Short <tshort@redhat.com>
tmshort added a commit to tmshort/operator-controller that referenced this issue Nov 16, 2023
Fix operator-framework#190

Signed-off-by: Todd Short <tshort@redhat.com>
github-merge-queue bot pushed a commit that referenced this issue Nov 17, 2023
* Remove ginkgo from internal/controller unit tests

Fix #190

Signed-off-by: Todd Short <tshort@redhat.com>

* Always allocate cl

Signed-off-by: Todd Short <tshort@redhat.com>

* Move admissions tests to tables

Signed-off-by: Todd Short <tshort@redhat.com>

* Use random name for operators

Signed-off-by: Todd Short <tshort@redhat.com>

* Parallelize the admission tests

Signed-off-by: Todd Short <tshort@redhat.com>

* Consolidate client/reconciler initialization

Signed-off-by: Todd Short <tshort@redhat.com>

---------

Signed-off-by: Todd Short <tshort@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants