Increase testability of Reconcilers in Lifecycle-Manager #1852
Labels
area/quality
Related to all activites around quality
kind/feature
Categorizes issue or PR as related to a new feature.
Description
Currently the majority of the code involved in the reconciliation loops cannot be unit tested.
We need to find out a way to make them testable.
The outcome of this issue should be:
Purge Reconciler
.We should be pragmatic: Because reconciliation is coupled to the
controller-runtime
library and, ultimately, to the K8s environment, it's unlikely that we can unit-test everything. Probably some small amount code used for object lookup, object updates etc. can't be easily unit tested. This is fine - this will be tested by the integration and E2E suites.What we should aim for is to have the business logic split into many independent functions/methods. Every function should be unit-testable. All behaviors that cannot be tested directly, like client-go functions, should be extracted out as explicit dependencies.
Reasons
Lack of unit tests for the reconciliation means we have to rely on integration and E2E tests. The problem is that these tests are verbose, long-running and slow - in comparison with unit tests.
We also cannot test all required scenarios and corner cases in this way because our test suites would take too much time to execute.
This is causing, among other things, the following problems:
All of the above make extending and debugging reconciler's code very hard, especially in the complex cases like the
Manifest Reconciler
.Acceptance Criteria
Purge Reconciler
Feature Testing
No response
Testing approach
No response
Attachments
No response
The text was updated successfully, but these errors were encountered: