Skip to content
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

Errors when attempting to add opentelemetry to plugin BOM #1032

Open
darinpope opened this issue Jan 30, 2025 · 1 comment
Open

Errors when attempting to add opentelemetry to plugin BOM #1032

darinpope opened this issue Jan 30, 2025 · 1 comment

Comments

@darinpope
Copy link
Contributor

What feature do you want to see added?

When I try to add opentelemetry to plugin BOM, I get the following 4 errors when running LINE=weekly PLUGINS=opentelemetry bash local-test.sh:

[ERROR] Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 1.707 s <<< FAILURE! -- in io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests
[ERROR] io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.testOnStartWithNewSpanStep[0] -- Time elapsed: 1.692 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.getExtensionList(java.lang.Class)" because the return value of "org.jvnet.hudson.test.JenkinsRule.getInstance()" is null
        at io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.setup(MonitoringPipelineListenerTest.java:114)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)

[ERROR] io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.testOnStartWithNewSpanStep[1] -- Time elapsed: 0.001 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.getExtensionList(java.lang.Class)" because the return value of "org.jvnet.hudson.test.JenkinsRule.getInstance()" is null
        at io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.setup(MonitoringPipelineListenerTest.java:114)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)

[ERROR] io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.testOnStartWithNewSpanStep[2] -- Time elapsed: 0 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.getExtensionList(java.lang.Class)" because the return value of "org.jvnet.hudson.test.JenkinsRule.getInstance()" is null
        at io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.setup(MonitoringPipelineListenerTest.java:114)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)

[ERROR] io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.testOnStartWithNewSpanStep[3] -- Time elapsed: 0.001 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.getExtensionList(java.lang.Class)" because the return value of "org.jvnet.hudson.test.JenkinsRule.getInstance()" is null
        at io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$ParamTests.setup(MonitoringPipelineListenerTest.java:114)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)

and 2 failures:

[ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 1.973 s <<< FAILURE! -- in io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$NonParamTests
[ERROR] io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$NonParamTests.testSetAttributesToSpanWithNotAllowedSpanId -- Time elapsed: 1.960 s <<< FAILURE!
java.lang.AssertionError: expected:<1> but was:<0>
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.failNotEquals(Assert.java:835)
        at org.junit.Assert.assertEquals(Assert.java:647)
        at org.junit.Assert.assertEquals(Assert.java:633)
        at io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$NonParamTests.testSetAttributesToSpanWithNotAllowedSpanId(MonitoringPipelineListenerTest.java:298)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)

[ERROR] io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$NonParamTests.testSetAttributesToSpan -- Time elapsed: 0.002 s <<< FAILURE!
java.lang.AssertionError: expected:<3> but was:<1>
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.failNotEquals(Assert.java:835)
        at org.junit.Assert.assertEquals(Assert.java:647)
        at org.junit.Assert.assertEquals(Assert.java:633)
        at io.jenkins.plugins.opentelemetry.job.MonitoringPipelineListenerTest$NonParamTests.testSetAttributesToSpan(MonitoringPipelineListenerTest.java:262)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)

When I run mvn clean verify on the opentelemetry repo, everything is fine. My guess is the BOM doesn't like the static classes inside of MonitoringPipelineListenerTest.

Any ideas how that might be refactored so that it might pass BOM?

Upstream changes

No response

Are you interested in contributing this feature?

No response

@cyrille-leclerc
Copy link
Contributor

@kuisathaverat @darinpope it's a style of JUnit tests I'm not familiar with, org.junit.runners.Parameterized tests. It's the only parameterized test in the code base and the only failure this PR is facing. I guess it's the cause of the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants