Skip to content

Instantly share code, notes, and snippets.

@mmalmeida
Created August 3, 2017 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmalmeida/7a6f24579657a67e9c78c221b950560b to your computer and use it in GitHub Desktop.
Save mmalmeida/7a6f24579657a67e9c78c221b950560b to your computer and use it in GitHub Desktop.
Jenkins test case
1. Create Maven Job
2. Goal: verify
3. Global settings file: Provided Global Settings: MySettings
4. Run Job. Result:
Building in workspace /srv/webapps/jenkins/jobs/testCase/workspace
Checking out a fresh workspace because there's no workspace at /srv/webapps/jenkins/jobs/testCase/workspace
Cleaning local Directory .
Checking out svn://dataservices/tools/trunk/mavenTest at revision '2017-08-03T15:03:14.204 +0100'
Using sole credentials jenkins/****** (<svn://dataservices> ITC Tools) in realm ‘<svn://dataservices:3690> ITC Tools’
A src
A src/test
A src/test/java
A src/test/java/com
A src/test/java/com/itc
A src/test/java/com/itc/test
AU src/test/java/com/itc/test/ClassTest.java
A src/test/resources
A src/main
A src/main/java
A src/main/java/com
A src/main/java/com/itc
A src/main/java/com/itc/mavenTest
A src/main/java/com/itc/mavenTest/tested
AU src/main/java/com/itc/mavenTest/tested/ClassTested.java
A src/main/java/com/itc/mavenTest/api
AU src/main/java/com/itc/mavenTest/api/SomeInterface.java
A src/main/java/com/itc/mavenTest/notTested
AU src/main/java/com/itc/mavenTest/notTested/ClassNotTested.java
A src/main/resources
A src/main/webapp
A src/main/webapp/WEB-INF
AU src/main/webapp/WEB-INF/web.xml
AU pom.xml
At revision 8500
Parsing POMs
using global settings config with name itc settings
Replacing all maven server entries not found in credentials list is true
ERROR: Failed to create /usr/share/tomcat7/.m2
Finished: FAILURE
5. In server command line, run: ln -s /srv/maven/.m2/ /usr/share/tomcat7/.m2
6. Run Job. Result:
Started by user anonymous
Building in workspace /srv/webapps/jenkins/jobs/testCase/workspace
Updating svn://dataservices/tools/trunk/mavenTest at revision '2017-08-03T15:04:38.414 +0100'
Using sole credentials jenkins/****** (<svn://dataservices> ITC Tools) in realm ‘<svn://dataservices:3690> ITC Tools’
At revision 8500
No changes for svn://dataservices/tools/trunk/mavenTest since the previous build
Parsing POMs
using global settings config with name itc settings
Replacing all maven server entries not found in credentials list is true
Discovered a new module com.itc.test:mavenTest mavenTest
Modules changed, recalculating dependency graph
Established TCP socket on 36334
[workspace] $ java -Xms128m -Xmx2048m -cp /srv/webapps/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.11.jar:/srv/webapps/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Jenkins_maven/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /srv/webapps/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Jenkins_maven /var/lib/tomcat7/webapps/jenkins/WEB-INF/lib/remoting-3.7.jar /srv/webapps/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.11.jar /srv/webapps/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.11.jar 36334
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:140)
at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:70)
Caused by: java.lang.RuntimeException: Root directory not writable: /usr/share/tomcat7/.jenkins/cache/jars
at hudson.remoting.FileSystemJarCache.<init>(FileSystemJarCache.java:53)
at hudson.remoting.Launcher.main(Launcher.java:638)
at hudson.remoting.Launcher.main(Launcher.java:629)
at hudson.remoting.Launcher.main(Launcher.java:625)
... 6 more
ERROR: ================================================================================
ERROR: Invalid project setup: Connection reset
ERROR: Processing failed due to a bug in the code. Please report this to the issue tracker (https://jenkins.io/redirect/report-an-issue).
java.lang.NullPointerException
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:304)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:803)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
at hudson.model.Run.execute(Run.java:1735)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:542)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
project=hudson.maven.MavenModuleSet@21467aad[testCase]
project.getModules()=[hudson.maven.MavenModule@e93544a[testCase/com.itc.test:mavenTest][testCase/com.itc.test:mavenTest][relativePath:]]
project.getRootModule()=hudson.maven.MavenModule@e93544a[testCase/com.itc.test:mavenTest][testCase/com.itc.test:mavenTest][relativePath:]
FATAL: null
java.lang.NullPointerException
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:304)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:803)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490)
at hudson.model.Run.execute(Run.java:1735)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:542)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
Finished: FAILURE
7. In server command line, run: /srv/webapps/jenkins/ /usr/share/tomcat7/.jenkins
Started by user anonymous
Building in workspace /srv/webapps/jenkins/jobs/testCase/workspace
Updating svn://dataservices/tools/trunk/mavenTest at revision '2017-08-03T15:06:22.901 +0100'
Using sole credentials jenkins/****** (<svn://dataservices> ITC Tools) in realm ‘<svn://dataservices:3690> ITC Tools’
At revision 8501
No changes for svn://dataservices/tools/trunk/mavenTest since the previous build
Parsing POMs
using global settings config with name itc settings
Replacing all maven server entries not found in credentials list is true
Established TCP socket on 34038
[workspace] $ java -Xms128m -Xmx2048m -cp /srv/webapps/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.11.jar:/srv/webapps/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Jenkins_maven/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /srv/webapps/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Jenkins_maven /var/lib/tomcat7/webapps/jenkins/WEB-INF/lib/remoting-3.7.jar /srv/webapps/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.11.jar /srv/webapps/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.11.jar 34038
<===[JENKINS REMOTING CAPACITY]===>channel started
using global settings config with name itc settings
Replacing all maven server entries not found in credentials list is true
Executing Maven: -B -f /srv/webapps/jenkins/jobs/testCase/workspace/pom.xml -gs /tmp/tomcat7-tomcat7-tmp/global-settings4088921656187777587.xml verify
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mavenTest 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ mavenTest ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ mavenTest ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /srv/webapps/jenkins/jobs/testCase/workspace/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ mavenTest ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ mavenTest ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /srv/webapps/jenkins/jobs/testCase/workspace/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ mavenTest ---
[INFO] Surefire report directory: /srv/webapps/jenkins/jobs/testCase/workspace/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.itc.test.ClassTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.039 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ mavenTest ---
(downloaded bunch of dependencies)
[INFO] Packaging webapp
[INFO] Assembling webapp [mavenTest] in [/srv/webapps/jenkins/jobs/testCase/workspace/target/mavenTest-1.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/srv/webapps/jenkins/jobs/testCase/workspace/src/main/webapp]
[INFO] Webapp assembled in [53 msecs]
[INFO] Building war: /srv/webapps/jenkins/jobs/testCase/workspace/target/mavenTest-1.0.1-SNAPSHOT.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] Packaging classes
[INFO] Building jar: /srv/webapps/jenkins/jobs/testCase/workspace/target/mavenTest-1.0.1-SNAPSHOT-classes.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.173s
[INFO] Finished at: Thu Aug 03 15:06:48 WEST 2017
[INFO] Final Memory: 26M/243M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /srv/webapps/jenkins/jobs/testCase/workspace/pom.xml to com.itc.test/mavenTest/1.0.1-SNAPSHOT/mavenTest-1.0.1-SNAPSHOT.pom
[JENKINS] Archiving /srv/webapps/jenkins/jobs/testCase/workspace/target/mavenTest-1.0.1-SNAPSHOT.war to com.itc.test/mavenTest/1.0.1-SNAPSHOT/mavenTest-1.0.1-SNAPSHOT.war
[JENKINS] Archiving /srv/webapps/jenkins/jobs/testCase/workspace/target/mavenTest-1.0.1-SNAPSHOT-classes.jar to com.itc.test/mavenTest/1.0.1-SNAPSHOT/mavenTest-1.0.1-SNAPSHOT-classes.jar
channel stopped
Finished: SUCCESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment