Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 1 | // Copyright 2017-present Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | node ("${TestNodeName}") { |
You Wang | e3214b9 | 2018-10-11 10:59:00 -0700 | [diff] [blame] | 16 | timeout (200) { |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 17 | try { |
| 18 | stage ("Parse deployment configuration file") { |
| 19 | sh returnStdout: true, script: "rm -rf ${configBaseDir}" |
| 20 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
You Wang | 59ded6c | 2018-10-05 17:43:44 -0700 | [diff] [blame] | 21 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 22 | } |
| 23 | stage('Download Cord-Tester Repo') { |
| 24 | timeout(2) { |
| 25 | sh returnStdout: true, script: """ |
You Wang | 59ded6c | 2018-10-05 17:43:44 -0700 | [diff] [blame] | 26 | rm -rf helm-charts cord-tester |
| 27 | git clone -b ${branch} ${cordRepoUrl}/helm-charts |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 28 | git clone -b ${branch} ${cordRepoUrl}/cord-tester |
| 29 | """ |
| 30 | } |
| 31 | } |
| 32 | stage('Test Configurations') { |
| 33 | timeout(10) { |
| 34 | sh """ |
| 35 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 36 | cd $WORKSPACE/cord-tester/src/test/cord-api/Properties/ |
| 37 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.nodes[0].ip}\'/\" RestApiProperties.py |
| 38 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py |
| 39 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 40 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 41 | cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/ |
| 42 | rm -rf Log/ || true |
| 43 | """ |
| 44 | } |
| 45 | } |
| 46 | stage('Subscriber Validation and Ping Tests') { |
You Wang | e3214b9 | 2018-10-11 10:59:00 -0700 | [diff] [blame] | 47 | timeout(180) { |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 48 | sh """ |
| 49 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 50 | cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/ |
Kailash | d6cd22e | 2018-12-10 08:53:16 -0800 | [diff] [blame] | 51 | robot --removekeywords wuks -d Log -T -l log-ATT_Test001 -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v HELM_CHARTS_DIR:$WORKSPACE/helm-charts WorkflowValidations/ATT_Test001.robot || true |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 52 | """ |
| 53 | } |
| 54 | } |
| 55 | stage('Publish test results') { |
| 56 | sh returnStdout: true, script: """ |
| 57 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs; |
| 58 | mkdir RobotLogs/TestDoc || true |
| 59 | cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true |
| 60 | cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true |
| 61 | """ |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 62 | step([$class: 'RobotPublisher', |
| 63 | disableArchiveOutput: false, |
| 64 | logFileName: 'RobotLogs/log*.html', |
| 65 | otherFiles: '', |
| 66 | outputFileName: 'RobotLogs/output*.xml', |
| 67 | outputPath: '.', |
| 68 | passThreshold: 100, |
| 69 | reportFileName: 'RobotLogs/report*.html', |
| 70 | unstableThreshold: 0 |
| 71 | ]) |
| 72 | } |
| 73 | currentBuild.result = 'SUCCESS' |
| 74 | } catch (err) { |
| 75 | currentBuild.result = 'FAILURE' |
| 76 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 77 | } |
| 78 | echo "RESULT: ${currentBuild.result}" |
| 79 | } |
| 80 | } |