Skip to content

InformerEventSource crashes with NPE on Tests  #890

Closed
@jonathanvila

Description

@jonathanvila

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions