-
Notifications
You must be signed in to change notification settings - Fork 220
InformerEventSource crashes with NPE on Tests #890
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
Comments
Hi @jonathanvila , this rings a bell, could you pls update to the newest version? of sdk 2.0.2? |
Why are you using 3.0.0-SNAPSHOT? Can you try with 3.0.2, please? |
Tried with Quarkus Operator SDK 3.0.2 ( JOSDK 2.0.2 ) , with same result :
|
This issue could be coming from the Quarkus distribution, looks like that Application Lifecycle Events are fired up even during the Tests. I found a possibly relevant PR: quarkusio/quarkus#15144 cc. @metacosm |
As per our conversation , the problem was related to this line : |
Bug Report
We have a test suite, that needs a new namespace for everytest. For that we use a new instance of the Operator on every test, assigning a client and a configuration pointing to the recently created test namespace.
With the "usual" conf , without a QuarkusMain class starting the operator.... we get an NPE on the InformerEventSource .
2022-01-31 16:56:16,387 ERROR [io.fab.kub.cli.inf.cac.SharedProcessor] (OkHttp https://192.168.39.20:8443/...) Failed invoking io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource$1@153670b3 event handler: null: java.lang.NullPointerException at io.javaoperatorsdk.operator.processing.event.source.controller.ControllerResourceCache.get(ControllerResourceCache.java:55) at io.javaoperatorsdk.operator.processing.event.EventProcessor.submitReconciliationExecution(EventProcessor.java:143)
This is the branch with the 2 test classes : keycloak/keycloak#9625
Code -> operator/src/test/org/keycloak/operator/ClusterOperatorTest , OperatorE2EIT
NOTE : the code contains the QuarkusMain to avoid these NPE in the log . Btw, these NPE are not affecting the test result.
What did you do?
mvn clean verify
-Dquarkus.kubernetes.deployment-target=kubernetes
--no-transfer-progress -Dtest.operator.deployment=local
What did you expect to see?
No NPE in the log.
What did you see instead? Under which circumstances?
NPE in the log .
To solve it we have added a QuarkusMain class ( thinking that with this class then the automatic start of the operator would not happen ) and no longer the NPE appears.
Environment
Kubernetes cluster type: minikube 1.24
$ Mention java-operator-sdk version from pom.xml file
Quarkus Operator SDK 3.0.0-SNAPSHOT
$ java -version
openjdk 11.0.13
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"archive", BuildDate:"2021-07-22T00:00:00Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3", GitCommit:"c92036820499fedefec0f847e2054d824aea6cd1", GitTreeState:"clean", BuildDate:"2021-10-27T18:35:25Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
Possible Solution
Additional context
The text was updated successfully, but these errors were encountered: