1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-11-24 08:32:32 +02:00

add ui5 consumer test (#802)

This commit is contained in:
Oliver Feldmann 2019-07-23 14:54:38 +02:00 committed by GitHub
parent 3d94ce4770
commit 79bc304c09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 12 deletions

View File

@ -22,6 +22,11 @@ class TestRunnerThread extends Thread {
def testCaseConfig
TestRunnerThread(File testCaseFile) {
this.testCaseConfig = new Yaml().load(testCaseFile.text)
if (!System.getenv(testCaseConfig.deployCredentialEnv.username) ||
!System.getenv(testCaseConfig.deployCredentialEnv.password)) {
throw new RuntimeException("Environment variables '${testCaseConfig.deployCredentialEnv.username}' and '${testCaseConfig.deployCredentialEnv.password}' need to be set.")
}
// Regex pattern expects a folder structure such as '/rootDir/areaDir/testCase.extension'
def testCaseMatches = (testCaseFile.toString() =~
/^[\w\-]+\\/([\w\-]+)\\/([\w\-]+)\..*\u0024/)
@ -34,7 +39,6 @@ class TestRunnerThread extends Thread {
this.uniqueName = "${area}|${testCase}"
this.testCaseRootDir = new File("${workspacesRootDir}/${area}/${testCase}")
this.testCaseWorkspace = "${testCaseRootDir}/workspace"
this.testCaseConfig = new Yaml().load(testCaseFile.text)
}
void run() {
@ -43,8 +47,10 @@ class TestRunnerThread extends Thread {
if (testCaseRootDir.exists() || !testCaseRootDir.mkdirs()) {
throw new RuntimeException("Creation of dir '${testCaseRootDir}' failed.")
}
executeShell("git clone -b ${testCase} ${testCaseConfig.referenceAppRepoUrl} " +
"${testCaseWorkspace}")
executeShell("git clone -b ${testCaseConfig.referenceAppRepo.branch} " +
"${testCaseConfig.referenceAppRepo.url} ${testCaseWorkspace}")
addJenkinsYmlToWorkspace()
setLibraryVersionInJenkinsfile()
@ -53,10 +59,12 @@ class TestRunnerThread extends Thread {
'--author="piper-testing-bot <piper-testing-bot@example.com>"',
'--message="Set piper lib version for test"'])
executeShell("docker run -v /var/run/docker.sock:/var/run/docker.sock " +
executeShell("docker run --rm -v /var/run/docker.sock:/var/run/docker.sock " +
"-v ${System.getenv('PWD')}/${testCaseWorkspace}:/workspace -v /tmp " +
"-e CASC_JENKINS_CONFIG=/workspace/jenkins.yml -e CX_INFRA_IT_CF_USERNAME " +
"-e CX_INFRA_IT_CF_PASSWORD -e BRANCH_NAME=${testCase} ppiper/jenkinsfile-runner")
"-e CASC_JENKINS_CONFIG=/workspace/jenkins.yml " +
"-e ${testCaseConfig.deployCredentialEnv.username} " +
"-e ${testCaseConfig.deployCredentialEnv.password} " +
"-e BRANCH_NAME=${testCaseConfig.referenceAppRepo.branch} ppiper/jenkinsfile-runner")
println "*****[INFO] Test case '${uniqueName}' finished successfully.*****"
printOutput()

View File

@ -68,10 +68,6 @@ if (!RUNNING_LOCALLY) {
}
}
if (!System.getenv('CX_INFRA_IT_CF_USERNAME') || !System.getenv('CX_INFRA_IT_CF_PASSWORD')) {
exitPrematurely('Environment variables CX_INFRA_IT_CF_USERNAME and CX_INFRA_IT_CF_PASSWORD need to be set.')
}
if (options.s) {
def file = new File(options.s)
if (!file.exists()) {

View File

@ -27,3 +27,9 @@ credentials:
username: ${CX_INFRA_IT_CF_USERNAME}
password: ${CX_INFRA_IT_CF_PASSWORD}
description: "SAP CP Trail account for test deployment"
- usernamePassword:
scope: GLOBAL
id: "neo_deploy"
username: ${NEO_DEPLOY_USERNAME}
password: ${NEO_DEPLOY_PASSWORD}
description: "SAP CP NEO Trail account for test deployment"

View File

@ -1,2 +1,7 @@
# Test case configuration
referenceAppRepoUrl: "https://github.com/piper-validation/cloud-s4-sdk-book"
referenceAppRepo:
url: "https://github.com/piper-validation/cloud-s4-sdk-book"
branch: "consumer-test-neo"
deployCredentialEnv:
username: "CX_INFRA_IT_CF_USERNAME"
password: "CX_INFRA_IT_CF_PASSWORD"

View File

@ -1,2 +1,7 @@
# Test case configuration
referenceAppRepoUrl: "https://github.com/piper-validation/cloud-s4-sdk-book"
referenceAppRepo:
url: "https://github.com/piper-validation/cloud-s4-sdk-book"
branch: "consumer-test"
deployCredentialEnv:
username: "CX_INFRA_IT_CF_USERNAME"
password: "CX_INFRA_IT_CF_PASSWORD"

View File

@ -0,0 +1,7 @@
# Test case configuration
referenceAppRepo:
url: "https://github.com/piper-validation/openui5-sample-app.git"
branch: "piper-test-ui5-neo"
deployCredentialEnv:
username: "NEO_DEPLOY_USERNAME"
password: "NEO_DEPLOY_PASSWORD"