Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -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 | // chart-api-test-helm.groovy |
| 16 | // Checks functionality of the helm-chart, without overriding the version/tag used |
| 17 | |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 18 | pipeline { |
| 19 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 20 | /* no label, executor is determined by JJB */ |
| 21 | agent { |
| 22 | label "${params.executorNode}" |
| 23 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 24 | |
| 25 | stages { |
| 26 | |
| 27 | stage('repo') { |
| 28 | steps { |
| 29 | checkout(changelog: false, \ |
| 30 | poll: false, |
| 31 | scm: [$class: 'RepoScm', \ |
| 32 | manifestRepositoryUrl: "${params.manifestUrl}", \ |
| 33 | manifestBranch: "${params.manifestBranch}", \ |
| 34 | currentBranch: true, \ |
| 35 | destinationDir: 'cord', \ |
| 36 | forceSync: true, |
| 37 | resetFirst: true, \ |
| 38 | quiet: true, \ |
| 39 | jobs: 4, \ |
| 40 | showAllChanges: true] \ |
| 41 | ) |
| 42 | } |
| 43 | } |
| 44 | |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 45 | stage('minikube') { |
| 46 | steps { |
| 47 | /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */ |
| 48 | sh ''' |
| 49 | export MINIKUBE_WANTUPDATENOTIFICATION=false |
| 50 | export MINIKUBE_WANTREPORTERRORPROMPT=false |
| 51 | export CHANGE_MINIKUBE_NONE_USER=true |
| 52 | export MINIKUBE_HOME=$HOME |
| 53 | mkdir -p $HOME/.kube || true |
| 54 | touch $HOME/.kube/config |
| 55 | export KUBECONFIG=$HOME/.kube/config |
| 56 | sudo -E /usr/bin/minikube start --vm-driver=none |
| 57 | ''' |
| 58 | script { |
| 59 | timeout(3) { |
| 60 | waitUntil { |
| 61 | sleep 5 |
| 62 | def kc_ret = sh script: "kubectl get po", returnStatus: true |
| 63 | return (kc_ret == 0); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | stage('helm') { |
| 71 | steps { |
| 72 | sh ''' |
| 73 | helm init |
| 74 | sleep 60 |
| 75 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
| 76 | ''' |
| 77 | } |
| 78 | } |
| 79 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 80 | stage('install/test rcord-lite') { |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 81 | steps { |
| 82 | sh """ |
| 83 | #!/usr/bin/env bash |
| 84 | set -eu -o pipefail |
| 85 | |
| 86 | helm_install_args='-f examples/api-test-values.yaml' |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 87 | |
| 88 | pushd cord/helm-charts |
| 89 | |
| 90 | helm dep up xos-core |
| 91 | helm install \${helm_install_args} xos-core -n xos-core |
| 92 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 93 | helm dep update xos-profiles/rcord-lite |
| 94 | helm install \${helm_install_args} xos-profiles/rcord-lite -n rcord-lite |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 95 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 96 | # wait for services to load |
Kailash Khalasi | edb48b1 | 2018-07-31 13:01:01 -0700 | [diff] [blame] | 97 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
Kailash Khalasi | ba3e3d7 | 2018-08-03 13:53:45 -0700 | [diff] [blame] | 98 | # adding tmp sleep momentarily |
| 99 | sleep 120 |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 100 | |
| 101 | echo "# Checking helm deployments" |
| 102 | kubectl get pods |
| 103 | helm list |
| 104 | |
| 105 | for hchart in \$(helm list -q); |
| 106 | do |
| 107 | echo "## 'helm status' for chart: \${hchart} ##" |
| 108 | helm status "\${hchart}" |
| 109 | done |
| 110 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 111 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 112 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 113 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 114 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 115 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 116 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 117 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 118 | export testname=_service_api.robot |
| 119 | export library=_library.robot |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 120 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 121 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 122 | echo \$SERVICES |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 123 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 124 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 125 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 126 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 127 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 128 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 129 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 130 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 131 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 132 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 133 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 134 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 135 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 136 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 137 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 138 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 139 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 140 | ## Run CORE API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 141 | pybot -d Log -T XOSCoreAPITests.robot || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 142 | ## Run Rcord-lite services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 143 | for i in \$SERVICES; do bash -c "pybot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 144 | |
| 145 | popd |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 146 | |
| 147 | helm delete --purge rcord-lite |
| 148 | helm delete --purge xos-core |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 149 | """ |
| 150 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 151 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 152 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 153 | stage('install/test mcord') { |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 154 | steps { |
| 155 | sh """ |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 156 | #!/usr/bin/env bash |
| 157 | set -eu -o pipefail |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 158 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 159 | helm_install_args='-f examples/api-test-values.yaml' |
| 160 | |
| 161 | pushd cord/helm-charts |
| 162 | |
| 163 | helm dep up xos-core |
| 164 | helm install \${helm_install_args} xos-core -n xos-core |
| 165 | |
| 166 | helm dep update xos-profiles/base-openstack |
| 167 | helm dep update xos-profiles/mcord |
| 168 | helm install \${helm_install_args} xos-profiles/base-openstack -n base-openstack |
| 169 | helm install \${helm_install_args} xos-profiles/mcord -n mcord |
| 170 | |
| 171 | # wait for services to load |
| 172 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
| 173 | |
| 174 | echo "# Checking helm deployments" |
| 175 | kubectl get pods |
| 176 | helm list |
| 177 | |
| 178 | for hchart in \$(helm list -q); |
| 179 | do |
| 180 | echo "## 'helm status' for chart: \${hchart} ##" |
| 181 | helm status "\${hchart}" |
| 182 | done |
| 183 | |
| 184 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 185 | |
| 186 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 187 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 188 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 189 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
| 190 | |
| 191 | export testname=_service_api.robot |
| 192 | export library=_library.robot |
| 193 | |
| 194 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 195 | echo \$SERVICES |
| 196 | |
| 197 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
| 198 | |
| 199 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
| 200 | |
| 201 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 202 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 203 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 204 | |
| 205 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 206 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 207 | |
| 208 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 209 | ## Run mcord services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 210 | for i in \$SERVICES; do bash -c "pybot -d Log -T -e ProgranServiceInstance -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 211 | |
| 212 | popd |
| 213 | |
| 214 | helm delete --purge base-openstack |
| 215 | helm delete --purge mcord |
| 216 | helm delete --purge xos-core |
| 217 | """ |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 218 | } |
| 219 | } |
| 220 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 221 | stage('install/test simpleexampleservice') { |
| 222 | steps { |
| 223 | sh """ |
| 224 | #!/usr/bin/env bash |
| 225 | set -eu -o pipefail |
| 226 | |
| 227 | helm_install_args='-f examples/api-test-values.yaml' |
| 228 | |
| 229 | pushd cord/helm-charts |
| 230 | |
| 231 | helm dep up xos-core |
| 232 | helm install \${helm_install_args} xos-core -n xos-core |
| 233 | |
| 234 | helm dep update xos-profiles/base-kubernetes |
| 235 | helm dep update xos-profiles/demo-simpleexampleservice |
| 236 | helm install \${helm_install_args} xos-profiles/base-kubernetes -n base-kubernetes |
| 237 | helm install \${helm_install_args} xos-profiles/demo-simpleexampleservice -n demo-simpleexampleservice |
| 238 | |
| 239 | # wait for services to load |
| 240 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
| 241 | |
| 242 | echo "# Checking helm deployments" |
| 243 | kubectl get pods |
| 244 | helm list |
| 245 | |
| 246 | for hchart in \$(helm list -q); |
| 247 | do |
| 248 | echo "## 'helm status' for chart: \${hchart} ##" |
| 249 | helm status "\${hchart}" |
| 250 | done |
| 251 | |
| 252 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 253 | |
| 254 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 255 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 256 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 257 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
| 258 | |
| 259 | export testname=_service_api.robot |
| 260 | export library=_library.robot |
| 261 | |
| 262 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 263 | echo \$SERVICES |
| 264 | |
| 265 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
| 266 | |
| 267 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
| 268 | |
| 269 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 270 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 271 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 272 | |
| 273 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 274 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 275 | |
| 276 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 277 | ## Run kubernetes-base services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 278 | for i in \$SERVICES; do bash -c "pybot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 279 | |
| 280 | popd |
| 281 | |
| 282 | helm delete --purge base-kubernetes |
| 283 | helm delete --purge demo-simpleexampleservice |
| 284 | helm delete --purge xos-core |
| 285 | """ |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | stage('install/test hippie-oss') { |
| 290 | steps { |
| 291 | sh """ |
| 292 | #!/usr/bin/env bash |
| 293 | set -eu -o pipefail |
| 294 | |
| 295 | helm_install_args='-f examples/api-test-values.yaml' |
| 296 | |
| 297 | pushd cord/helm-charts |
| 298 | |
| 299 | helm dep up xos-core |
| 300 | helm install \${helm_install_args} xos-core -n xos-core |
| 301 | |
| 302 | helm dep update xos-services/hippie-oss |
| 303 | helm install \${helm_install_args} xos-services/hippie-oss -n hippie-oss |
| 304 | |
| 305 | # wait for services to load |
| 306 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
| 307 | ## sleeping as hippie-oss doesnt have a tosca-loader |
| 308 | sleep 300 |
| 309 | echo "# Checking helm deployments" |
| 310 | kubectl get pods |
| 311 | helm list |
| 312 | |
| 313 | for hchart in \$(helm list -q); |
| 314 | do |
| 315 | echo "## 'helm status' for chart: \${hchart} ##" |
| 316 | helm status "\${hchart}" |
| 317 | done |
| 318 | |
| 319 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 320 | |
| 321 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 322 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 323 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 324 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
| 325 | |
| 326 | export testname=_service_api.robot |
| 327 | export library=_library.robot |
| 328 | |
| 329 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 330 | echo \$SERVICES |
| 331 | |
| 332 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 333 | ## Run hippie-oss services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 334 | for i in \$SERVICES; do bash -c "pybot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 335 | |
| 336 | popd |
| 337 | |
| 338 | helm delete --purge hippie-oss |
| 339 | helm delete --purge xos-core |
| 340 | """ |
| 341 | } |
| 342 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 343 | } |
| 344 | post { |
| 345 | always { |
| 346 | sh ''' |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 347 | # copy robot logs |
| 348 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
| 349 | cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/Log/*ml ./RobotLogs |
Kailash Khalasi | ecb4eb6 | 2018-07-31 15:20:19 -0700 | [diff] [blame] | 350 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 351 | kubectl get pods --all-namespaces |
| 352 | |
| 353 | echo "# removing helm deployments" |
| 354 | kubectl get pods |
| 355 | helm list |
| 356 | |
| 357 | for hchart in \$(helm list -q); |
| 358 | do |
| 359 | echo "## Purging chart: \${hchart} ##" |
| 360 | helm delete --purge "\${hchart}" |
| 361 | done |
| 362 | |
Zack Williams | f8b356c | 2018-07-17 17:01:27 -0700 | [diff] [blame] | 363 | sudo minikube delete |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 364 | ''' |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 365 | step([$class: 'RobotPublisher', |
| 366 | disableArchiveOutput: false, |
| 367 | logFileName: 'RobotLogs/log*.html', |
| 368 | otherFiles: '', |
| 369 | outputFileName: 'RobotLogs/output*.xml', |
| 370 | outputPath: '.', |
| 371 | passThreshold: 100, |
| 372 | reportFileName: 'RobotLogs/report*.html', |
| 373 | unstableThreshold: 0]); |
| 374 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 375 | } |
| 376 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 377 | } |