instana/instana-agent-operator

AgentDeployerTest suite fails on ppc64le with NullPointerException

Closed this issue · 3 comments

SUMMARY

On executing ./mvnw -C -B clean verify on ppc64le, the build (to be specific, 5 tests in AgentDeployerTest suite) fails. Relevant part of the log pasted below:

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.instana.operator.AgentDeployerTest
[ERROR] Tests run: 5, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 1.792 s <<< FAILURE! - in com.instana.operator.AgentDeployerTest
[ERROR] daemonset_must_include_environment  Time elapsed: 1.593 s  <<< ERROR!
java.lang.NullPointerException
        at com.instana.operator.AgentDeployerTest.daemonset_must_include_environment(AgentDeployerTest.java:64)

[ERROR] daemonset_must_include_specified_image  Time elapsed: 0.042 s  <<< ERROR!
java.lang.NullPointerException
        at com.instana.operator.AgentDeployerTest.daemonset_must_include_specified_image(AgentDeployerTest.java:86)

[ERROR] daemonset_must_not_include_version_label_if_not_specified_on_crd  Time elapsed: 0.058 s  <<< ERROR!
java.lang.NullPointerException
        at com.instana.operator.AgentDeployerTest.daemonset_must_not_include_version_label_if_not_specified_on_crd(AgentDeployerTest.java:164)

[ERROR] daemonset_must_include_version_label_if_specified_on_crd  Time elapsed: 0.057 s  <<< ERROR!
java.lang.NullPointerException
        at com.instana.operator.AgentDeployerTest.daemonset_must_include_version_label_if_specified_on_crd(AgentDeployerTest.java:135)

[ERROR] daemonset_must_include_image_from_csv_if_specified  Time elapsed: 0.029 s  <<< ERROR!
java.lang.NullPointerException
        at com.instana.operator.AgentDeployerTest.daemonset_must_include_image_from_csv_if_specified(AgentDeployerTest.java:105)

[INFO] Running com.instana.operator.cache.CacheTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.14 s - in com.instana.operator.cache.CacheTest
[INFO] Running com.instana.operator.cache.RetryTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 s - in com.instana.operator.cache.RetryTest
[INFO] Running com.instana.operator.coordination.AgentCoordinatorTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.031 s - in com.instana.operator.coordination.AgentCoordinatorTest
[INFO] Running com.instana.operator.customresource.InstanaAgentSpecDeserializeTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 s - in com.instana.operator.customresource.InstanaAgentSpecDeserializeTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   AgentDeployerTest.daemonset_must_include_environment:64 » NullPointer
[ERROR]   AgentDeployerTest.daemonset_must_include_image_from_csv_if_specified:105 » NullPointer
[ERROR]   AgentDeployerTest.daemonset_must_include_specified_image:86 » NullPointer
[ERROR]   AgentDeployerTest.daemonset_must_include_version_label_if_specified_on_crd:135 » NullPointer
[ERROR]   AgentDeployerTest.daemonset_must_not_include_version_label_if_not_specified_on_crd:164 » NullPointer
[INFO]
[ERROR] Tests run: 28, Failures: 0, Errors: 5, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

For full log, please refer instana-build-failure.txt

I compared the result on x86, where it does not fail. After debugging, I found that the NullPointerException is triggered from this line.

instana-agent-operator VERSION

v1.0.0

OS, environment

RHEL 8.2 ppc64le
java 11
maven 3.6.3

Steps to reproduce the problem

yum install -y java-11-openjdk-devel wget git

wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar xzf apache-maven-3.6.3-bin.tar.gz
rm -rf apache-maven-3.6.3-bin.tar.gz

export MAVEN_HOME=$CWD/apache-maven-3.6.3
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH

git clone https://github.com/instana/instana-agent-operator.git
cd instana-agent-operator/
git checkout v1.0.0
./mvnw -C -B clean verify

Expected Results

The tests should pass.

Please help me resolve this issue. Thanks!

Just did a POC. I was able to get around 4 errors by commenting out this block. The version related failure is seen now, since the commented block is supposed to update the VERSION_LABEL using the one from crd.

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.instana.operator.AgentDeployerTest
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.649 s <<< FAILURE! - in com.instana.operator.AgentDeployerTest
[ERROR] daemonset_must_include_version_label_if_specified_on_crd  Time elapsed: 0.051 s  <<< FAILURE!
java.lang.AssertionError:

Expected: map containing [is "app.kubernetes.io/version"->is "0.3.8"]
     but: map was [<app.kubernetes.io/managed-by=instana-agent-operator>]
        at com.instana.operator.AgentDeployerTest.daemonset_must_include_version_label_if_specified_on_crd(AgentDeployerTest.java:141)

[INFO] Running com.instana.operator.cache.CacheTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.133 s - in com.instana.operator.cache.CacheTest
[INFO] Running com.instana.operator.cache.RetryTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in com.instana.operator.cache.RetryTest
[INFO] Running com.instana.operator.coordination.AgentCoordinatorTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.046 s - in com.instana.operator.coordination.AgentCoordinatorTest
[INFO] Running com.instana.operator.customresource.InstanaAgentSpecDeserializeTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 s - in com.instana.operator.customresource.InstanaAgentSpecDeserializeTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   AgentDeployerTest.daemonset_must_include_version_label_if_specified_on_crd:141
Expected: map containing [is "app.kubernetes.io/version"->is "0.3.8"]
     but: map was [<app.kubernetes.io/managed-by=instana-agent-operator>]
[INFO]
[ERROR] Tests run: 28, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.928 s
[INFO] Finished at: 2021-03-03T09:22:39-05:00
[INFO] ------------------------------------------------------------------------

I'm still unable to figure out why the get() call here throws NullPointerException even when defaultClient.customResourceDefinitions().withName(CRD_NAME) does not return null. I also checked the type of object being returned using .getClass().getName(), which is io.fabric8.kubernetes.client.dsl.internal.apiextensions.v1beta1.CustomResourceDefinitionOperationsImpl.

Please help me find the root cause. Thanks!

The issue has been fixed in the tag v1.0.4 with this commit.

Apologies for not addressing this here sooner. As you can see we fully rebuild the Operator in Golang and could not spend a lot of time addressing issues on the older Java Operator.