jenkins: stages with e2e tests inside try catch

pull/661/head
cruizba 2021-10-21 19:19:02 +02:00
parent 43a045bec6
commit 377f338f09
1 changed files with 43 additions and 29 deletions

View File

@ -130,19 +130,41 @@ node('container') {
docker.image('selenium/standalone-chrome:latest').withRun('-p 6666:4444 --name chrome --shm-size=1g -v /opt/openvidu:/opt/openvidu') { a ->
docker.image('selenium/standalone-firefox:latest').withRun('-p 6667:4444 --name firefox --shm-size=1g') { b ->
docker.image('selenium/standalone-opera:latest').withRun('-p 6668:4444 --name opera --shm-size=1g') { c ->
// -----
// Kurento TESTS
// -----
stage ('Environment Launch Kurento') {
environmentLaunch('kurento')
}
try {
stage ('OpenVidu Kurento E2E tests') {
openViduE2ETest('kurento')
}
} catch (error) {
echo "Test failed"
currentBuild.result = 'FAILURE'
} finally {
// Kill all environment for next test
environmentStop()
}
// ----
// Mediasoup TESTS
// ----
stage ('Environment Launch Mediasoup') {
environmentLaunch('mediasoup')
}
try {
stage ('OpenVidu Mediasoup E2E tests') {
openViduE2ETest('mediasoup')
}
} catch (error) {
echo "Test failed"
currentBuild.result = 'FAILURE'
} finally {
environmentStop()
junit 'openvidu/openvidu-test-e2e/**/target/surefire-reports/TEST-*.xml'
archiveArtifacts artifacts: '**/openvidu-server.log'
}
}
}
@ -175,10 +197,10 @@ def environmentLaunch(mediaServer) {
until $(curl --insecure --output /dev/null --silent http://${KMS_IP}:8888/kurento); do echo "Waiting for ${mediaServer}..."; sleep 1; done
if [ "$DOCKER_RECORDING_VERSION" != "default" ]; then
echo "Using custom openvidu-recording tag: $DOCKER_RECORDING_VERSION"
java -jar -DKMS_URIS=[\\"ws://${KMS_IP}:8888/kurento\\"] -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
java -jar -DKMS_URIS=[\\"ws://${KMS_IP}:8888/kurento\\"] -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_RECORDING_VERSION=$DOCKER_RECORDING_VERSION -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server-${mediaServer}.log &
else
echo "Using default openvidu-recording tag"
java -jar -DKMS_URIS=[\\"ws://${KMS_IP}:8888/kurento\\"] -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server.log &
java -jar -DKMS_URIS=[\\"ws://${KMS_IP}:8888/kurento\\"] -DDOMAIN_OR_PUBLIC_IP=172.17.0.1 -DOPENVIDU_SECRET=MY_SECRET -DHTTPS_PORT=4443 -DOPENVIDU_RECORDING=true -DOPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/test-layouts -DOPENVIDU_WEBHOOK=true -DOPENVIDU_WEBHOOK_ENDPOINT=http://127.0.0.1:7777/webhook /opt/openvidu/openvidu-server-*.jar &> openvidu-server-${mediaServer}.log &
fi
'''.stripIndent())
}
@ -194,7 +216,6 @@ def environmentStop() {
def openViduE2ETest(mediaServer) {
script {
env.mediaServer = mediaServer
try {
sh(script: '''#!/bin/bash -xe
cd openvidu
if [[ $OPENVIDU_TESTE2E_COMMIT != "default" ]]; then
@ -210,12 +231,5 @@ def openViduE2ETest(mediaServer) {
sudo mvn --batch-mode -DMEDIA_SERVER=${mediaServer} -Dtest=OpenViduTestAppE2eTest -DAPP_URL=https://172.17.0.1:4200/ -DOPENVIDU_URL=https://172.17.0.1:4443/ -DREMOTE_URL_CHROME=http://172.17.0.1:6666/wd/hub/ -DREMOTE_URL_FIREFOX=http://172.17.0.1:6667/wd/hub/ -DREMOTE_URL_OPERA=http://172.17.0.1:6668/wd/hub/ -DEXTERNAL_CUSTOM_LAYOUT_URL=http://172.17.0.1:5555 -DEXTERNAL_CUSTOM_LAYOUT_PARAMS=sessionId,CUSTOM_LAYOUT_SESSION,secret,MY_SECRET test
git checkout -f $OPENVIDU_COMMIT
'''.stripIndent())
} catch (err) {
echo "Test failed"
currentBuild.result = 'FAILURE'
} finally {
junit 'openvidu/openvidu-test-e2e/**/target/surefire-reports/TEST-*.xml'
archiveArtifacts artifacts: '**/openvidu-server.log'
}
}
}