-
Notifications
You must be signed in to change notification settings - Fork 223
Description
Hello,
I'm a beginner in the whole operator framework, and have some problems settings up certain testcases and/or cannot find the relevant documentation for it.
In essence, what I want to test, is that my reconciler is actually reconciling. Therefore, in my test I apply a CR that the reconciler listens to, and expect the reconciler to act upon it.
However, I am struggling how to setup this, due to several options for mocking which seem to not tick all my boxes:
- When using the
@EnableKubernetesMockClient
, my reconciler seems not to be able to watch (atleast it does not get any events, while themasterUrl
is the same as the test cases) - When using
@EnableKubernetesMockClient
does not allow for SSA, which is troublesome with the recent versions of JOSDK.
Another struggle for me, is to inject a KubernetesClient
in my testcases, that is also shared with my real application. Since Spring does not scan @TestConfigurations
, I need to mark my KubernetesClient
as a @Configuration
, which I doubt is what i really should do.
How would one approach such a test, where the requirements are it must be fully mocked (thus not be using my .kubeconfig).
Spring Boot:3.5.3
io.javaoperatorsdk:operator-framework:5.1.1
io.javaoperatorsdk:operator-framework-junit-5:5.1.2
io.fabric8:kube-api-test:7.3.1
io.fabric8:kubernetes-server-mock:7.3.1