-
Notifications
You must be signed in to change notification settings - Fork 50
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 unit tests to use gomock. #203
Migrate unit tests to use gomock. #203
Conversation
The controller suite test execution time has come down from |
@shreyas-s-rao, @abdasgupta, @ishan16696 You have pull request review open invite, please check |
39c1633
to
4f8edd5
Compare
/assign |
4f8edd5
to
e01c319
Compare
e01c319
to
9da93c6
Compare
It is still used in
The existing tests covered whole reconciliation. Wanting to be sure that I still cover all the existing test cases after the migration, I retained the migrated tests also to cover whole of reconciliation. But I used nesting to introduce more variations in the test cases by piecemeal nesting and also to avoid too much duplication of the test setup.
Indeed, the goal is to modularise the reconciliation flow and to be able to then test these smaller functions independently. This way we should also be able to reduce the nesting of test blocks into independent test descriptions. I think this is best done over a few more PRs than in one single PR, if only to make sure we are not regressing or worse, losing test cases that were already covered. |
@timuthy Thanks for the review! I have addressed your comments. Can you PTAL? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thank you 👍
e817c64
to
724e5c2
Compare
724e5c2
to
b99d8f1
Compare
@amshuman-kr You need rebase this pull request with latest master branch. Please check. |
Let's close this in favor of #278 which will allow us to have sufficient coverage for single components (+ easy maintenance as opposed to maintaining plenty of Gomock assertions) and only a handful of envtest like tests which test the controller from end-to-end. |
How to categorize this PR?
/area control-plane
/kind technical-debt
What this PR does / why we need it:
Migrate all controller unit tests to use gomock framework. I have also tried to make the test flow easier to understand, to contribute and maintain.
Which issue(s) this PR fixes:
Fixes #97
Special notes for your reviewer:
This is in preparation for #186 so that any regressions can be caught early in the unit tests.
Apologies for large changes to
etcd_controller_test.go
but it made sense to rationalise test flow. I have also added additional tests in the deletion use-case as well many other permutations and combinations for regular reconciliation.Release note: