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

Test ScaledObject and ScaledJob Controllers #1008

Closed
zroubalik opened this issue Aug 18, 2020 · 6 comments
Closed

Test ScaledObject and ScaledJob Controllers #1008

zroubalik opened this issue Aug 18, 2020 · 6 comments
Labels
feature-request All issues for new features that have not been committed to needs-discussion stale All issues that are marked as stale due to inactivity

Comments

@zroubalik
Copy link
Member

We should use envtest test framework to test our controllers.

The current test file is just a stub: https://github.com/kedacore/keda/blob/950c5e16deb143a8201189ec7430f7350d0fa6bd/controllers/suite_test.go

@zroubalik zroubalik added needs-discussion feature-request All issues for new features that have not been committed to labels Aug 18, 2020
@zroubalik zroubalik added this to the v2.0 milestone Aug 18, 2020
@zroubalik
Copy link
Member Author

@TsuyoshiUshio do you think this is something that you can use to migrate and extend your ScaleJob Mock based tests to?

@TsuyoshiUshio
Copy link
Contributor

TsuyoshiUshio commented Aug 18, 2020

Hi @zroubalik
For the individual unit testing some mock mechanism is required. However, if you want to go with ginkgo, we can change the assertion part. https://github.com/kedacore/keda/blob/v2/pkg/scaling/executor/scale_jobs_test.go#L44
I also considered to use the framework, however, it is great for controller logic validation, however it looks integration testing for the controller. We might need to something for simple unit testing for each part. For example, executor/scale_jobs , we might want to write a test as unit testing for each classes, right? However, this is just my opinion and I might misunderstand the framework. If we can write any unit testing, I'm happy about it. I agree with use the framework! Also we need a tool for unit testing for individual testing. BTW, I used to read unit testing document on the operator sdk official side. However, I can't find it now. I 'd like to read it to understand the framework. Do you know where it is?

@zroubalik
Copy link
Member Author

Thanks for the info. I haven't had a time to look at both frameworks closely, so don't know the details. So might be worth exploring if we can merge both unit and integration tests under one framework. If you think that it is ok, we can keep the current state for now.

@zroubalik
Copy link
Member Author

zroubalik commented Aug 19, 2020

@zroubalik zroubalik changed the title [v2] Test ScaledObject and ScaledJob Controllers Test ScaledObject and ScaledJob Controllers Oct 15, 2020
@zroubalik zroubalik removed this from the v2.0 milestone Oct 15, 2020
@stale
Copy link

stale bot commented Oct 14, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Oct 14, 2021
@stale
Copy link

stale bot commented Oct 21, 2021

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Oct 21, 2021
SpiritZhou pushed a commit to SpiritZhou/keda that referenced this issue Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request All issues for new features that have not been committed to needs-discussion stale All issues that are marked as stale due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants