Kailash Khalasi | e6f414c | 2018-05-14 13:40:36 -0700 | [diff] [blame] | 1 | --- |
| 2 | # xos unit test |
| 3 | |
| 4 | - job-template: |
| 5 | id: 'xos-unit-test' |
Kailash Khalasi | 38cb5cd | 2018-05-16 09:49:15 -0700 | [diff] [blame] | 6 | name: 'verify_{project}_unit-test' |
Kailash Khalasi | e6f414c | 2018-05-14 13:40:36 -0700 | [diff] [blame] | 7 | |
| 8 | description: | |
| 9 | Created by {id} job-template from ci-management/jjb/xos-unit.yaml |
| 10 | |
| 11 | triggers: |
| 12 | - cord-infra-gerrit-trigger-patchset: |
| 13 | gerrit-server-name: '{gerrit-server-name}' |
| 14 | project-regexp: '^{project}$' |
| 15 | branch-regexp: '{branch-regexp}' |
| 16 | dependency-jobs: '{dependency-jobs}' |
| 17 | file-include-regexp: '{all-files-regexp}' |
| 18 | |
| 19 | properties: |
| 20 | - cord-infra-properties: |
| 21 | build-days-to-keep: '{build-days-to-keep}' |
| 22 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 23 | |
| 24 | wrappers: |
| 25 | - lf-infra-wrappers: |
| 26 | build-timeout: 20 |
| 27 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 28 | |
| 29 | scm: |
| 30 | - lf-infra-gerrit-scm: |
| 31 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 32 | refspec: '$GERRIT_REFSPEC' |
| 33 | branch: '$GERRIT_BRANCH' |
| 34 | submodule-recursive: 'false' |
| 35 | choosing-strategy: gerrit |
| 36 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 37 | |
| 38 | node: 'ubuntu16.04-basebuild-1c-2g' |
| 39 | project-type: freestyle |
| 40 | concurrent: true |
| 41 | |
| 42 | builders: |
| 43 | - shell: | |
| 44 | #/usr/bin/env bash |
| 45 | BASEDIR=$(pwd) |
| 46 | |
| 47 | # setup virtual env |
| 48 | virtualenv -q venv-xos --no-site-packages |
| 49 | source $BASEDIR/venv-xos/bin/activate |
| 50 | pip install --upgrade pip setuptools |
| 51 | |
| 52 | # download changeset |
| 53 | mkdir cord && cd cord/ |
| 54 | repo init -u https://gerrit.opencord.org/manifest -b $GERRIT_BRANCH |
| 55 | repo sync |
| 56 | repo download $GERRIT_PROJECT $GERRIT_CHANGE_NUMBER/$GERRIT_PATCHSET_NUMBER |
| 57 | |
| 58 | # Install XOS dependencies |
Kailash Khalasi | 206e90a | 2018-05-15 14:57:51 -0700 | [diff] [blame] | 59 | pip install nose2 requests_mock plyxproto jinja2 pattern astunparse pyyaml colorama |
| 60 | pip install pykwalify==1.6.1 |
| 61 | pip install multistructlog==1.5 |
Kailash Khalasi | 4f04d63 | 2018-05-24 10:23:27 -0700 | [diff] [blame] | 62 | pip install networkx==1.11 |
| 63 | pip install netaddr==0.7.19 |
| 64 | pip install ipaddress==1.0.19 |
Zack Williams | 38e8cdb | 2018-05-31 12:36:27 -0700 | [diff] [blame] | 65 | pip install grpcio==1.9.1 |
| 66 | pip install grpcio-tools==1.9.1 |
Kailash Khalasi | fb1ba24 | 2018-06-08 14:30:51 -0700 | [diff] [blame^] | 67 | pip install kafka==1.3.5 |
Kailash Khalasi | e6f414c | 2018-05-14 13:40:36 -0700 | [diff] [blame] | 68 | echo "Requirements Installed" |
| 69 | |
| 70 | cd $BASEDIR/cord/orchestration/xos/lib/xos-util; python setup.py install; echo "xos-util Installed" |
| 71 | cd $BASEDIR/cord/orchestration/xos/lib/xos-config; python setup.py install; echo "xos-config Installed" |
| 72 | cd $BASEDIR/cord/orchestration/xos/lib/xos-genx; python setup.py install; echo "xos-genx Installed" |
Zack Williams | 35d9248 | 2018-05-31 12:17:53 -0700 | [diff] [blame] | 73 | |
| 74 | cd $BASEDIR/cord/orchestration/xos/xos/xos_client/xosapi; ln -s ../../../../../component/chameleon chameleon |
Zack Williams | a834c34 | 2018-05-31 11:30:15 -0700 | [diff] [blame] | 75 | cd $BASEDIR/cord/orchestration/xos/xos/xos_client; make; echo "xos-client Installed" |
Kailash Khalasi | e6f414c | 2018-05-14 13:40:36 -0700 | [diff] [blame] | 76 | |
| 77 | # Run the tests |
Kailash Khalasi | f4f484c | 2018-05-25 14:08:01 -0700 | [diff] [blame] | 78 | if [ $GERRIT_PROJECT = 'xos' ] ; then |
| 79 | cd $BASEDIR |
| 80 | else |
| 81 | cd $BASEDIR/cord/orchestration/xos_services/$GERRIT_PROJECT/xos |
| 82 | fi |
Kailash Khalasi | e6f414c | 2018-05-14 13:40:36 -0700 | [diff] [blame] | 83 | nose2 --verbose --exclude-ignored-files |