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

Fix mockito issues with JDK11 and jenkins 2.222.3 #194

Closed
wants to merge 2 commits into from
Closed

Fix mockito issues with JDK11 and jenkins 2.222.3 #194

wants to merge 2 commits into from

Conversation

nfalco79
Copy link
Member

@nfalco79 nfalco79 commented May 2, 2020

This PR will fix the issue of test cases in master when run on JDK11
The solution was remove mockito from this class so that now master can use the mockito version defined in the parent pom.

@dwnusbaum the issue is regardless the version of mockito. If run individually the test pass. If you run all together something play with cache of mockito/bytebuddy that causes the constructor not be visible.

@nfalco79
Copy link
Member Author

nfalco79 commented May 2, 2020

@dwnusbaum build passed

Copy link
Member

@dwnusbaum dwnusbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixing the Mockito issues! I added a comment about slf4j, but instead of updating the version of slf4j, can you please update the parent POM to 4.1 and update jenkins.version to 2.176.4? Thanks!

pom.xml Outdated
@@ -68,6 +68,7 @@
<revision>2.5.7</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.138.4</jenkins.version>
<slf4jVersion>1.7.26</slf4jVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This silences the enforcer, but it isn't the ideal way to fix the issue in Jenkins. slf4j and associated packages are dependencies of Jenkins core itself, so the version that the plugin specifies here is not actually used in practice (see this page for more information). The best way to fix this is to update the parent POM to a 4.x version, which uses a BOM to address conflicts with dependencies of Jenkins core itself, and then update jenkins.version here to a version that supports the BOM, e.g. 2.176.4. After that, you will be able to remove this line, and 1.7.25 will automatically be used when running against the version of Jenkins and 1.7.26 will be used when running against the new version of Jenkins, and the enforcer will be happy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was my first tentative in other PR and I removed the jenkins.version to leave the organisation pom guide the jenkins version.
Do you prefer set a specific version of jenkins instead use that one defined on organisation pom?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason why prefer 2.176.4 instead of that one defined in organisation pom (2.204) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 2.176.4 test fails

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 2.222.3 test fails.

Override BOM plugin version with those defined in master test fails again.
Single test in eclipse not happens, debug in mvn clean test -Dmave.surefure.debug step by step not happens only run when run all together not in debug.
Seems a timing issue. The test look if a FreestyleProject master exists for top/stuff but it has not yet been by organisation folder scan.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.176.4 is a conservative choice.
Not sure what do about test failures.

Copy link
Member Author

@nfalco79 nfalco79 May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that nothing seems to work as expected.
The organisation pom version is the cause <= 3.56 test passes. With version >= 3.57 fails
Using jenkins.version 2.176.4 test passes (locally) but will fail on CI system because runs with 2.222.3 and will fail on enforcer.

@nfalco79
Copy link
Member Author

nfalco79 commented May 5, 2020

now fails on different unit tests that always passes, re-trigger the build to verify if are flaky faillures

@dwnusbaum
Copy link
Member

@nfalco79 I think the root cause of all the remaining issues was static state from earlier tests interfering with later tests, and configuring surefire to use separate processes for each test suite (<reuseForks>false</reuseForks>) seems to fix the test failures and allows us to update to version 4.x of the parent POM, see #192.

@nfalco79 nfalco79 closed this May 7, 2020
@nfalco79 nfalco79 deleted the feature/mockito branch June 15, 2020 15:38
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

Successfully merging this pull request may close these issues.

3 participants