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

MigrateJUnitTestCase does not fully migrate tests #369

Open
gounthar opened this issue Nov 6, 2024 · 0 comments
Open

MigrateJUnitTestCase does not fully migrate tests #369

gounthar opened this issue Nov 6, 2024 · 0 comments

Comments

@gounthar
Copy link
Collaborator

gounthar commented Nov 6, 2024

What feature do you want to see added?

I tried the command:
java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --plugins pipeline-multibranch-defaults --recipes AddOrModernizeJenkinsFile,AddDependencyCheck,MigrateJUnitTestCase,AddPluginsBom,UpgradeNextMajorParentVersion,UpgradeBomVersion,RemoveDependencyVersionOverride,RemoveExtraMavenProperties,UpgradeToJava17,MigrateJUnitTestCase,AddOrModernizeJenkinsFile,AddDependencyCheck --skip-pull-request
and got an incomplete migration.
We still have some imports of Junit4.
This mix leads to errors when running the tests:

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
Running tests for org.jenkins-ci.plugins:pipeline-multibranch-defaults:2.2-SNAPSHOT
[INFO] Running org.jenkins_ci.plugins.pipeline_multibranch_defaults.InjectedTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.412 s -- in org.jenkins_ci.plugins.pipeline_multibranch_defaults.InjectedTest
[INFO] Running org.jenkinsci.plugins.pipeline.multibranch.defaults.DefaultsBinderTest
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.312 s <<< FAILURE! -- in org.jenkinsci.plugins.pipeline.multibranch.defaults.DefaultsBinderTest
[ERROR] org.jenkinsci.plugins.pipeline.multibranch.defaults.DefaultsBinderTest.testDefaultJenkinsFileLoadFromWorkspace -- Time elapsed: 0.013 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.getExtensionList(java.lang.Class)" because "this.r.jenkins" is null
        at org.jenkinsci.plugins.pipeline.multibranch.defaults.DefaultsBinderTest.testDefaultJenkinsFileLoadFromWorkspace(DefaultsBinderTest.java:85)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

[ERROR] org.jenkinsci.plugins.pipeline.multibranch.defaults.DefaultsBinderTest.testDefaultJenkinsFile -- Time elapsed: 0.002 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.getExtensionList(java.lang.Class)" because "this.r.jenkins" is null
        at org.jenkinsci.plugins.pipeline.multibranch.defaults.DefaultsBinderTest.testDefaultJenkinsFile(DefaultsBinderTest.java:61)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

[INFO] Running org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactoryTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.313 s <<< FAILURE! -- in org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactoryTest
[ERROR] org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactoryTest.allBranches -- Time elapsed: 0.013 s <<< ERROR!
java.lang.IllegalStateException: the temporary folder has not yet been created
        at org.junit.rules.TemporaryFolder.getRoot(TemporaryFolder.java:299)
        at jenkins.plugins.git.GitSampleRepoRule.init(GitSampleRepoRule.java:81)
        at org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactoryTest.allBranches(PipelineBranchDefaultsProjectFactoryTest.java:50)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

[INFO] Running org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectFactoryTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.313 s <<< FAILURE! -- in org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectFactoryTest
[ERROR] org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectFactoryTest.configureAndIndexChildren -- Time elapsed: 0.015 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.createProject(java.lang.Class, String)" because "this.r.jenkins" is null
        at org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectFactoryTest.configureAndIndexChildren(PipelineMultiBranchDefaultsProjectFactoryTest.java:53)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

[INFO] Running org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.300 s <<< FAILURE! -- in org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectTest
[ERROR] org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectTest.newProjectFactory -- Time elapsed: 0.011 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "jenkins.model.Jenkins.createProject(java.lang.Class, String)" because "this.r.jenkins" is null
        at org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineMultiBranchDefaultsProjectTest.newProjectFactory(PipelineMultiBranchDefaultsProjectTest.java:49)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Upstream changes

No response

Are you interested in contributing this feature?

No response

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

1 participant