fix: refs #6695 try parallel
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-10 15:23:39 +01:00
parent a56378242e
commit 69e57154cf
1 changed files with 18 additions and 12 deletions

30
Jenkinsfile vendored
View File

@ -111,17 +111,7 @@ pipeline {
steps {
script {
runTestsInParallel()
def containerId = sh(script: "docker-compose -p ${env.NETWORK} -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
if (containerId) {
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/"
if (exitCode != '0') {
def logs = sh(script: "docker logs ${containerId}", returnStdout: true).trim()
error("Cypress E2E tests failed with exit code: ${exitCode}\nLogs:\n${logs}")
}
} else {
error("The Docker container for E2E tests could not be created")
}
}
}
}
@ -202,7 +192,7 @@ def cleanDockerE2E() {
def runTestsInParallel() {
// def integrationTests = sh(script: "ls -d test/cypress/integration/*/ || echo ''", returnStdout: true).trim().split('\n')
def integrationTests = ['test/cypress/integration/claim/', 'test/cypress/integration/client/']
def integrationTests = ['test/cypress/integration/claim/', 'test/cypress/integration/client/', 'test/cypress/integration/entry/', 'test/cypress/integration/invoiceIn/']
def tasks = [:]
integrationTests.each { testFolder ->
@ -215,6 +205,7 @@ def runTestsInParallel() {
sh "docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up -d back"
sh "docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up -d front"
sh "CYPRESS_SPEC=test/cypress/integration/${folderName}/**/*.spec.js docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml up e2e"
checkErrors()
}
}
}
@ -222,3 +213,18 @@ def runTestsInParallel() {
parallel tasks
}
def checkErrors(){
def containerId = sh(script: "docker-compose -p ${env.NETWORK}_${folderName} -f docker-compose.e2e.yml ps -q e2e", returnStdout: true).trim()
if (containerId) {
def exitCode = sh(script: "docker inspect -f '{{.State.ExitCode}}' ${containerId}", returnStdout: true).trim()
sh "docker cp ${containerId}:/app/test/cypress/reports ./test/cypress/"
if (exitCode != '0') {
def logs = sh(script: "docker logs ${containerId}", returnStdout: true).trim()
error("Cypress E2E tests failed with exit code: ${exitCode}\nLogs:\n${logs}")
}
} else {
error("The Docker container for E2E tests could not be created")
}
}