You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keycloak is creating an Operator per test class. Via cdi there is a single instance of each controller being constructed. When initAndRegisterEventSources is then called multiple times on these controllers if they maintain the same standalone depenent resource instance, the subsequent calls fail with an NPE:
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.size()" because "m" is null
at java.base/java.util.HashMap.putMapEntries(HashMap.java:495)
at java.base/java.util.HashMap.putAll(HashMap.java:783)
at io.javaoperatorsdk.operator.processing.event.source.informer.InformerManager.addIndexers(InformerManager.java:196)
at io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource.setConfigurationService(InformerEventSource.java:355)
at io.javaoperatorsdk.operator.processing.event.EventSourceManager.registerEventSource(EventSourceManager.java:160)
... 71 more
If this should be called multiple times, it should be re-initialized instead.
For now the keycloak pr keycloak/keycloak#22299 is working around this by creating a new depedent resource instance each time prepareEventSources is called. Does that seem ok for now, or should we make sure new instances of the Reconcilers are created for each test?
The text was updated successfully, but these errors were encountered:
I'm also seeing this with non-stanalone sources after some additional test changes. I'll link to the workaround in the pr once it is opened. The basic problem is that we're manually re-creating the operator per each test class, which may not be a good idea.
From keycloak/keycloak#22299 (comment) -
Keycloak is creating an Operator per test class. Via cdi there is a single instance of each controller being constructed. When initAndRegisterEventSources is then called multiple times on these controllers if they maintain the same standalone depenent resource instance, the subsequent calls fail with an NPE:
See https://github.com/keycloak/keycloak/actions/runs/5809929842/job/15750155150#step:8:10297
This does not seem to affect dependent resources that are registered via annotations.
The cause is nulling out the indexerBuffer
java-operator-sdk/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java
Line 368 in b66ef93
If this should be called multiple times, it should be re-initialized instead.
For now the keycloak pr keycloak/keycloak#22299 is working around this by creating a new depedent resource instance each time prepareEventSources is called. Does that seem ok for now, or should we make sure new instances of the Reconcilers are created for each test?
The text was updated successfully, but these errors were encountered: