Merge pull request #3302 from dassiorleando/master
BAEL-720: better handle failed test in Jenkins pipeline
This commit is contained in:
commit
13b9b3d9e6
|
@ -31,25 +31,36 @@ node {
|
||||||
|
|
||||||
stage("Tests and Deployment") {
|
stage("Tests and Deployment") {
|
||||||
parallel 'Unit tests': {
|
parallel 'Unit tests': {
|
||||||
stage("Runing unit tests") {
|
stage("Running unit tests") {
|
||||||
|
try {
|
||||||
if (isUnix()) {
|
if (isUnix()) {
|
||||||
sh "./mvnw test -Punit"
|
sh "./mvnw test -Punit"
|
||||||
} else {
|
} else {
|
||||||
bat "./mvnw.cmd test -Punit"
|
bat "./mvnw.cmd test -Punit"
|
||||||
}
|
}
|
||||||
|
} catch(err) {
|
||||||
|
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
|
||||||
|
throw err
|
||||||
|
}
|
||||||
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
|
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*UnitTest.xml'])
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 'Integration tests': {
|
}, 'Integration tests': {
|
||||||
stage("Runing integration tests") {
|
stage("Running integration tests") {
|
||||||
|
try {
|
||||||
if (isUnix()) {
|
if (isUnix()) {
|
||||||
sh "./mvnw test -Pintegration"
|
sh "./mvnw test -Pintegration"
|
||||||
} else {
|
} else {
|
||||||
bat "./mvnw.cmd test -Pintegration"
|
bat "./mvnw.cmd test -Pintegration"
|
||||||
}
|
}
|
||||||
|
} catch(err) {
|
||||||
|
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*IntegrationTest.xml'])
|
||||||
|
throw err
|
||||||
|
}
|
||||||
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*IntegrationTest.xml'])
|
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*IntegrationTest.xml'])
|
||||||
}
|
}
|
||||||
}, 'Deployment': {
|
}
|
||||||
|
|
||||||
stage("Staging") {
|
stage("Staging") {
|
||||||
if (isUnix()) {
|
if (isUnix()) {
|
||||||
sh "pid=\$(lsof -i:8989 -t); kill -TERM \$pid || kill -KILL \$pid"
|
sh "pid=\$(lsof -i:8989 -t); kill -TERM \$pid || kill -KILL \$pid"
|
||||||
|
@ -67,5 +78,4 @@ node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,6 +6,6 @@ import static org.junit.Assert.*;
|
||||||
public class SomeUnitTest {
|
public class SomeUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void init() {
|
public void init() {
|
||||||
assertEquals(1, 0);
|
assertEquals(1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue