Refactoring: Remove localClient
global Variable in remote
pkg
#1126
Labels
area/quality
Related to all activites around quality
kind/cleanup
Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Milestone
Description
To have some of our code testable in EnvTest, we introduced a global variable called
localClient
in theremote
package.But, we should not have production ready code including code which is just used for testing, instead the code should be written in a way that it is testable without such modifications.
The global var
localClient
is set during EnvTests when creating a new SKRCluster, and thus when the LifecycleManager tries to resolve the SKRClient, it instead used the setlocalClient
. With the current implementation each test scenario using theNewSKRCluster
func runs in its own virtual SKR cluster, it would be great to keep such behaviour to have separated test cases.The
initializeKymaContext
is a standalone function, but it could be a method on a new i.e. RemoteClientFactory (explicit deps on Kyma reconciler; new interface). The dependency could be replaced in the envTest with a Factory returning the localClient instead of SKR Client.Reasons
Acceptance Criteria
restConfigFromStrategy
in such a way that it does not use a global variable to determine if a localClient should be usedFeature Testing
Integration tests
Testing approach
No response
Attachments
No response
The text was updated successfully, but these errors were encountered: