I am running Jenkins version 1.411 and use Maven for building.
Even though the application builds successfully, Jenkins treats it as an unstable build. I have disabled all tests to isolate the problem.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.389s
[INFO] Finished at: Wed May 11 12:16:57 EST 2011
[INFO] [DocLinks] Skip document Adaptiv generated site ... (No such directory: site)
Final Memory: 27M/543M
[INFO] ------------------------------------------------------------------------
channel stopped
Archiving artifacts
Email was triggered for: Unstable
Sending email for trigger: Unstable
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: SUCCESS
It's some time ago that I used hudson/jenkins but you should have a look at the Jenkins Glossary
Unstable build: A build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the build will be marked unstable.
Publisher: A publisher is part of the build process other than compilation, for example JUnit test runs. A publisher may report stable or unstable result depending on the result of its processing. For example, if a JUnit test fails, then the whole JUnit publisher may report unstable.
So I suppose you have some other build parts (apart from JUnit) that report an unstable result. Have a look at the whole build process log.
If you have unit tests, make sure that they run when executing your build.
In my case, the unit tests are not run and Jenkins tagged the build as Unstable.
When checking the console output, I found that 0 unit tests were running :
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
The fix for me is will not help resolve this topic but no harm to mention it:
I was Spring boot 2.2 and when I upgraded to v2.5, JUnit 5’s Vintage Engine was removed from spring-boot-starter-test, so I needed to add it to execute tests using JUnit 4.
Related
When running serenity tests in jenkins I have a stage that runs mvn clean verify. My problem is that this stage always passes as the build of the tests is successful and the stage passes. At the end of the stage I see:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:39 min
[INFO] Finished at: 2023-01-24T14:50:04Z
[INFO] ------------------------------------------------------------------------
even though there are test failures and errors. One solution to this was to use the catchError method with the following:
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
sh "exit 1"
}
but this always shows unstable as some of my tests check error conditions and they pass when an error is thrown. I'd like the tests to be shown as passed in jenkins when Serenity says the tests have passed. Is there a way to do this?
A
I have a legacy websphere EE7 app I am attempting to convert to run on openliberty. It now seems to run on openliberty which is great.
However the integration tests do not seem to run. They hot compile, but do not run. The application is deployed as an EAR file.
The log is below with no evidence of the tests running when I hit enter.
[INFO] To run tests on demand, press Enter.
[INFO] Waiting up to 30 seconds to find the application start up or update message...
[INFO] CWWKM2010I: Searching for (CWWKZ0001I:|CWWKZ0003I:) in <app name removed>\logs\messages.log. This search will timeout after 30 seconds.
[INFO] CWWKM2015I: Match number: 1 is [19/07/22 18:06:21:660 NZST] 00000037 com.ibm.ws.app.manager.AppMessageHelper
A CWWKZ0001I: Application <my application> started in 17.692 seconds..
[INFO] Running integration tests...
[INFO] Integration tests finished.
[INFO]
[INFO] To run tests on demand, press Enter.
[INFO] Tests compilation was successful.
[INFO] Running integration tests...
[INFO] Integration tests finished.
[INFO]
[INFO] To run tests on demand, press Enter.
[INFO] Running integration tests...
[INFO] Integration tests finished.
[INFO]
[INFO] To run tests on demand, press Enter.
Has anyone got any tips on how I can get the tests to run when I press enter? They must be being called from something, or have their path set by something, or require some maven plugin configuration?
After cloning the github repository, updating Maven to 3.0.5, updating the JDK, and executing the build.sh, my build of sonarqube failed after a number of unit test failures, the first of which reads
app_with_severities_when_period_is_set(org.sonar.server.component.ws.ComponentAppActionTest) Time elapsed: 0.007 sec <<< FAILURE!
java.lang.AssertionError: periods[0][2]
Expected: 2014-05-08T00:00:00+0200
got: 2014-05-08T00:00:00-0500
at org.skyscreamer.jsonassert.JSONAssert.assertEquals(JSONAssert.java:222)
at org.skyscreamer.jsonassert.JSONAssert.assertEquals(JSONAssert.java:192)
at org.sonar.server.ws.WsTester$Result.assertJson(WsTester.java:193)
at org.sonar.server.ws.WsTester$Result.assertJson(WsTester.java:183)
at org.sonar.server.component.ws.ComponentAppActionTest.app_with_severities_when_period_is_set(ComponentAppActionTest.java:400)
The build message was
[INFO] SonarQube :: Search ............................... SUCCESS [55.995s]
[INFO] SonarQube :: Server ............................... FAILURE [5:23.832s]
[INFO] SonarQube :: Plugins :: Xoo ....................... SKIPPED
I have obtained this problem on MacOSX, Ubuntu, EL5 and EL6. Is there any way around it?
This is a known issue on test execution with other timezone than Europe/Paris.
You can try building SQ with -Duser.timezone="Europe/Paris"
I have a little bit of strange Problem with Jenkins, Maven and Tycho and it is hard to find out who is the culprit.
All SCM Triggered Builds fail but all manually triggered builds succeed.
Jenkins Version : Jenkins ver. 1.527
Maven Version : 3.05
I have a modularized tycho build:
<modules>
<module>../main.plugin.test</module>
<module>../main.plugin.internationalization.at</module>
<module>../crud.plugin</module>
<module>../rest.plugin</module>
<module>../main.plugin</module>
<module>../main.feature</module>
<module>../product</module>
<module>../target-definition</module>
<module>../rest.plugin.test</module>
</modules>
Jenkins is configured as a simple maven build with modules.
It just executes:
-X clean deploy
When an SCM-Build is triggered some modules are not build.
When I build it manually everything is fine:
This behaviour is consistent. I already tried
switching to a different Maven version (3.05 / 3.04)
deleting the whole workspace prior to building
clean checkout of all sources
running of -X deploy (without clean)
Any amount of manual invocations succeeds. And any amount of scm triggers fails.
Both Maven logs look exactly the same until (working):
[INFO] Reactor Build Order:
[INFO]
[INFO] client-master
[INFO] crud-plugin
[INFO] main-plugin
[INFO] ------------.main.plugin.test
[INFO] ------------.main.plugin.internationalization.at
[INFO] rest-plugin
[INFO] main-plugin
[INFO] ------------.product
[INFO] target-definition
[INFO] ------------.rest.plugin.test
and (failing):
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] main-plugin
[INFO] ------------.plugin.test
[INFO] ------------.main.plugin.internationalization.at
[INFO] rest-plugin
[INFO] main-plugin
[INFO] ------------.product
[INFO] ------------.rest.plugin.test
The final error message therefore is:
Caused by: java.lang.IllegalStateException: ------------..client:------------..crud.plugin:eclipse-plugin:1.0.0-SNAPSHOT does not provide an artifact with classifier 'null'
Customer specific module names are replaced with ------------. in this question.
I have heard repeatedly of vague problems with Tycho builds on Jenkins. The reason for these problems seems to be that some Jenkins plugin triggering these builds hooks into the Maven lifecycle and this somehow collides with what Tycho does in the Maven internals.
For the problem that you are describing, it seems that the Jenkins plugin that you are using is changing the module build order. This may be okay for a normal Maven build (where all dependencies are declared in the POMs), but may fail for a Maven/Tycho build, where dependencies are computed by Tycho during the build.
To avoid this problem, you should trigger the Maven build in a way that is closer to a normal command line build. I found that the Invoke top-level Maven targets build step from the Maven Integration plugin works without problems.
I am trying to build a multi-module Maven project using Jenkins.
When I build the same project on the command-line using the same environment (variables/settings.xml/user) as Jenkins does, test failures cause the build to fail immediately:
Failed tests:
testSomething(com.package_name.TestSomethingOrTheOther)
Tests run: .., Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
...
# Build fails immediately
Where-as when building in Jenkins:
Failed tests:
testSomething(com.package_name.TestSomethingOrTheOther)
Tests run: .., Failures: 1, Errors: 0, Skipped: 0
[ERROR] There are test failures.
...
# Build continues to other modules
...
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] parent ................................................ SUCCESS [.....s]
[INFO] module-that-failed .................................... SUCCESS [.....s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
The build states that all modules and parent are SUCCESS-ful, when in reality, these should be failures.
How do I get Jenkins to enforce fail-fast in maven builds as maven does in the command-line?
Thanks in advance.
Jenkins ignores test failures by default, and then marks the build as unstable if they were any.
The parameter that controls that is: testFailureIgnore (see surefire plugin doc)
I've never tried that, but I would attempt to override that setting on the jenkins job configuration:
-Dmaven.test.failure.ignore=false
You can specify MAVEN_OPTS if you click on Advanced button in the Build section.